perfsonar-dev - r1410 - trunk/perfsonar/src/org/perfsonar/commons/util
Subject: perfsonar development work
List archive
- From:
- To:
- Subject: r1410 - trunk/perfsonar/src/org/perfsonar/commons/util
- Date: Thu, 13 Jul 2006 07:36:11 -0400
Author: roman
Date: 2006-07-13 07:36:10 -0400 (Thu, 13 Jul 2006)
New Revision: 1410
Modified:
trunk/perfsonar/src/org/perfsonar/commons/util/XMLUtils.java
Log:
Changes required to use Maciej's new implementation of xmldb access.
Modified: trunk/perfsonar/src/org/perfsonar/commons/util/XMLUtils.java
===================================================================
--- trunk/perfsonar/src/org/perfsonar/commons/util/XMLUtils.java
2006-07-13 11:34:24 UTC (rev 1409)
+++ trunk/perfsonar/src/org/perfsonar/commons/util/XMLUtils.java
2006-07-13 11:36:10 UTC (rev 1410)
@@ -9,7 +9,10 @@
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
+
import java.util.Iterator;
+import java.util.Map;
+import java.util.HashMap;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -17,12 +20,15 @@
import org.apache.xml.serialize.OutputFormat;
import org.apache.xml.serialize.XMLSerializer;
+
import org.ggf.ns.nmwg.base.v2_0.Element;
import org.ggf.ns.nmwg.base.v2_0.Handler;
import org.ggf.ns.nmwg.base.v2_0.Message;
+
import org.perfsonar.service.commons.exceptions.PerfSONARException;
import org.perfsonar.service.commons.exceptions.RequestException;
import org.perfsonar.service.commons.exceptions.SystemException;
+
import org.w3c.dom.Document;
import org.xml.sax.ContentHandler;
import org.xml.sax.InputSource;
@@ -37,6 +43,7 @@
* The class contains several methods for various text operations with the
XML
*
* @author Maciej Glowiak
+ * @author romradz (contributor)
*
*/
public class XMLUtils {
@@ -253,7 +260,7 @@
/**
* Returns nmwg object with specific tag name parsed from xml string
*/
- public static Element getElementFromXML(String xmlPart, String tagName,
String parserFile) {
+ public static Map<String, Element> getElementFromXML(String xmlPart,
String tagName, String parserFile) {
String DEFAULT_PARSER_NAME = "org.apache.xerces.parsers.SAXParser";
String NAMESPACES_FEATURE_ID =
"http://xml.org/sax/features/namespaces";
@@ -305,9 +312,9 @@
}
- Element element = handler.getElement(tagName);
+ Map<String, Element> elements = handler.getElement(tagName);
- return element;
+ return elements;
}
@@ -338,8 +345,10 @@
}
- public Element getElement(String name) {
+ public Map<String, Element> getElement(String name) {
+ Map<String, Element> map = new HashMap();
+
Iterator it = ht.values().iterator();
Element element = null;
boolean found = false;
@@ -349,15 +358,17 @@
String ln = element.getLocalName();
if (ln.equals(name)) {
found = true;
- break;
+ map.put(element.getId(), element);
}
}
if (!found) return null;
- return element;
+ return map;
}
}
-
+
+
+
} //XMLUtils
- r1410 - trunk/perfsonar/src/org/perfsonar/commons/util, svnlog, 07/13/2006
Archive powered by MHonArc 2.6.16.