You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2005/12/14 01:57:31 UTC

svn commit: r356660 - /webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java

Author: dims
Date: Tue Dec 13 16:57:27 2005
New Revision: 356660

URL: http://svn.apache.org/viewcvs?rev=356660&view=rev
Log:
implement nextTag - thanks to Guillaume Nodet

Modified:
    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java?rev=356660&r1=356659&r2=356660&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java Tue Dec 13 16:57:27 2005
@@ -782,7 +782,7 @@
     }
 
     /**
-     * Not implemented yet
+     * nextTag - returns the next tag
      *
      * @return
      * @throws org.apache.axis2.om.impl.llom.exception.OMStreamingException
@@ -790,9 +790,20 @@
      * @throws XMLStreamException
      */
     public int nextTag() throws XMLStreamException {
-        throw new UnsupportedOperationException();
+        int eventType = next();
+        while((eventType == XMLStreamConstants.CHARACTERS && isWhiteSpace()) // skip whitespace
+            || (eventType == XMLStreamConstants.CDATA && isWhiteSpace()) // skip whitespace
+            || eventType == XMLStreamConstants.SPACE
+            || eventType == XMLStreamConstants.PROCESSING_INSTRUCTION
+            || eventType == XMLStreamConstants.COMMENT) {
+            eventType = next();
+         }
+         if (eventType != XMLStreamConstants.START_ELEMENT && eventType != XMLStreamConstants.END_ELEMENT) {
+             throw new XMLStreamException("expected start or end tag", getLocation());
+         }
+         return eventType;    
     }
-
+    
     /**
      * @return
      * @throws XMLStreamException