dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #06421
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2041: Added method to read QName
------------------------------------------------------------
revno: 2041
committer: Bob Jolliffe bobjolliffe@xxxxxxxxx
branch nick: trunk
timestamp: Thu 2010-06-24 15:38:23 +0100
message:
Added method to read QName
modified:
dhis-2/dhis-services/dhis-service-xml/src/main/java/org/amplecode/staxwax/reader/DefaultXMLEventReader.java
dhis-2/dhis-services/dhis-service-xml/src/main/java/org/amplecode/staxwax/reader/DefaultXMLStreamReader.java
dhis-2/dhis-services/dhis-service-xml/src/main/java/org/amplecode/staxwax/reader/XMLReader.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-xml/src/main/java/org/amplecode/staxwax/reader/DefaultXMLEventReader.java'
--- dhis-2/dhis-services/dhis-service-xml/src/main/java/org/amplecode/staxwax/reader/DefaultXMLEventReader.java 2010-05-10 18:08:02 +0000
+++ dhis-2/dhis-services/dhis-service-xml/src/main/java/org/amplecode/staxwax/reader/DefaultXMLEventReader.java 2010-06-24 14:38:23 +0000
@@ -79,6 +79,24 @@
}
@Override
+ public QName getElementQName()
+ {
+ QName qName = null;
+
+ if ( currentEvent.isStartElement() )
+ {
+ qName = currentEvent.asStartElement().getName();
+ }
+
+ if ( currentEvent.isEndElement() )
+ {
+ qName = currentEvent.asEndElement().getName();
+ }
+
+ return qName;
+ }
+
+ @Override
public String getElementValue()
{
try
=== modified file 'dhis-2/dhis-services/dhis-service-xml/src/main/java/org/amplecode/staxwax/reader/DefaultXMLStreamReader.java'
--- dhis-2/dhis-services/dhis-service-xml/src/main/java/org/amplecode/staxwax/reader/DefaultXMLStreamReader.java 2010-02-22 09:37:31 +0000
+++ dhis-2/dhis-services/dhis-service-xml/src/main/java/org/amplecode/staxwax/reader/DefaultXMLStreamReader.java 2010-06-24 14:38:23 +0000
@@ -36,6 +36,7 @@
import java.util.HashMap;
import java.util.Map;
+import javax.xml.namespace.QName;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
@@ -83,6 +84,14 @@
}
@Override
+ public QName getElementQName()
+ {
+ final int eventType = reader.getEventType();
+
+ return eventType == START_ELEMENT || eventType == END_ELEMENT ? reader.getName() : null;
+ }
+
+ @Override
public String getElementValue()
{
try
=== modified file 'dhis-2/dhis-services/dhis-service-xml/src/main/java/org/amplecode/staxwax/reader/XMLReader.java'
--- dhis-2/dhis-services/dhis-service-xml/src/main/java/org/amplecode/staxwax/reader/XMLReader.java 2010-02-19 18:38:02 +0000
+++ dhis-2/dhis-services/dhis-service-xml/src/main/java/org/amplecode/staxwax/reader/XMLReader.java 2010-06-24 14:38:23 +0000
@@ -29,6 +29,7 @@
*/
import java.util.Map;
+import javax.xml.namespace.QName;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLStreamReader;
@@ -43,11 +44,18 @@
{
/**
* Reads the name of the current XML element.
- *
+ *
* @return The name of the current XML element.
*/
String getElementName();
-
+
+ /**
+ * Reads the QName of the current XML element.
+ *
+ * @return The QName of the current XML element.
+ */
+ QName getElementQName();
+
/**
* Reads the value of the current XML element.
*