# HG changeset patch # User Raimund Renkert # Date 1302771899 -7200 # Node ID 27577294f9ca2ab55c5e62da286d88cd6e1fb780 # Parent c14a92c7628d9b747ff61de69470c21b6c6cfb09 Added root element to document and save the filename in the XML tree. diff -r c14a92c7628d -r 27577294f9ca ChangeLog --- a/ChangeLog Wed Apr 13 16:38:03 2011 +0200 +++ b/ChangeLog Thu Apr 14 11:04:59 2011 +0200 @@ -1,3 +1,8 @@ +2011-04-12 Raimund Renkert + + * src/java/de/intevation/mxd/utils/MapToXMLUtils.java: + Added root element to document and save the filename in the XML tree. + 2011-04-13 Bjoern Schilberg * A contrib/sh/test_mxd.cgi diff -r c14a92c7628d -r 27577294f9ca src/java/de/intevation/mxd/utils/MapToXMLUtils.java --- a/src/java/de/intevation/mxd/utils/MapToXMLUtils.java Wed Apr 13 16:38:03 2011 +0200 +++ b/src/java/de/intevation/mxd/utils/MapToXMLUtils.java Thu Apr 14 11:04:59 2011 +0200 @@ -21,11 +21,21 @@ public class MapToXMLUtils { private Document root; + private Element rootElement; private XMLUtils.ElementCreator creator; public MapToXMLUtils() { this.root = XMLUtils.newDocument(); creator = new XMLUtils.ElementCreator(root, "", ""); + rootElement = creator.create("mxd"); + root.appendChild(rootElement); + } + + public boolean addFilename(String path) { + Element file = creator.create("file"); + file.setAttribute("name", path); + rootElement.appendChild(file); + return true; } /** @@ -39,7 +49,7 @@ NodeList list = root.getElementsByTagName("map"); if(list == null || list.getLength() == 0){ map = creator.create("map"); - root.appendChild(map); + rootElement.appendChild(map); } else if(list.getLength() == 1){ map = (Element)list.item(0); @@ -100,4 +110,8 @@ public void print() { XMLUtils.toStream(root, System.out); } + + public Document getDocument() { + return root; + } }