changeset 38:27577294f9ca

Added root element to document and save the filename in the XML tree.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 14 Apr 2011 11:04:59 +0200
parents c14a92c7628d
children f807c9c81019
files ChangeLog src/java/de/intevation/mxd/utils/MapToXMLUtils.java
diffstat 2 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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 <raimund.renkert@intevation.de>
+
+	* 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  <bjoern.schilberg@intevation.de>
 
 	* A contrib/sh/test_mxd.cgi
--- 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;
+    }
 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)