comparison src/java/de/intevation/mxd/utils/MapToXMLUtils.java @ 43:ef7ca23c4233

Added comments, done some code styling and removed typos.
author Raimund Renkert <rrenkert@intevation.de>
date Fri, 15 Apr 2011 15:44:54 +0200
parents 27577294f9ca
children 6b80d2c7536e
comparison
equal deleted inserted replaced
42:395307e8b7ee 43:ef7ca23c4233
18 * 18 *
19 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> 19 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
20 */ 20 */
21 public class MapToXMLUtils 21 public class MapToXMLUtils
22 { 22 {
23 /**
24 * The logger.
25 */
26 private static final Logger logger = Logger.getLogger(MapToXMLUtils.class);
27
28 /**
29 * Private member.
30 */
23 private Document root; 31 private Document root;
24 private Element rootElement; 32 private Element rootElement;
25 private XMLUtils.ElementCreator creator; 33 private XMLUtils.ElementCreator creator;
34
26 35
27 public MapToXMLUtils() { 36 public MapToXMLUtils() {
28 this.root = XMLUtils.newDocument(); 37 this.root = XMLUtils.newDocument();
29 creator = new XMLUtils.ElementCreator(root, "", ""); 38 creator = new XMLUtils.ElementCreator(root, "", "");
30 rootElement = creator.create("mxd"); 39 rootElement = creator.create("mxd");
31 root.appendChild(rootElement); 40 root.appendChild(rootElement);
32 } 41 }
33 42
43 /**
44 * Add the mxd filename to the dom.
45 * @param path Path to the mxdfile.
46 * @return Currently always true.
47 */
34 public boolean addFilename(String path) { 48 public boolean addFilename(String path) {
35 Element file = creator.create("file"); 49 Element file = creator.create("file");
36 file.setAttribute("name", path); 50 file.setAttribute("name", path);
37 rootElement.appendChild(file); 51 rootElement.appendChild(file);
38 return true; 52 return true;
39 } 53 }
40 54
41 /** 55 /**
42 * Create the top level map element. 56 * Create the top level map element.
43 *
44 * @return The new map element. 57 * @return The new map element.
45 */ 58 */
46 public Element createMap() 59 public Element createMap()
47 throws Exception { 60 throws Exception {
48 Element map; 61 Element map;
109 */ 122 */
110 public void print() { 123 public void print() {
111 XMLUtils.toStream(root, System.out); 124 XMLUtils.toStream(root, System.out);
112 } 125 }
113 126
127 /**
128 * Get the DOM document.
129 * @return The root document.
130 */
114 public Document getDocument() { 131 public Document getDocument() {
115 return root; 132 return root;
116 } 133 }
117 } 134 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)