Hi

I do not manage to obtain the same results described in the XmlCursor
javadoc (
http://xmlbeans.apache.org/docs/2.0.0/reference/org/apache/xmlbeans/XmlCursor.html)
when analyzing the sample XML file.

According to the javadoc I should get:

 <sample x='y'>
     <value>foo</value>
 </sample>

STARTDOC
START (sample)
ATTR (x='y')
TEXT ("\n ")
START (value)
TEXT ("foo")
END (value)
TEXT ("\n")
END (sample)
ENDDOC


But with my source code:

            XmlObject xmlObj = XmlObject.Factory.parse("<sample
x='y'><value>foo</value></sample>");
            XmlCursor curs = xmlObj.newCursor();

            while (!curs.isEnd()) {
                XmlCursor.TokenType tokenType = curs.currentTokenType();
                System.out.println(tokenType.toString());
                curs.toNextToken();
            }


I only get:

STARTDOC
START
ATTR
START
TEXT

How should I modify my code to obtain the other tokens of the document (eg.
END of sample, value, document, etc.) ?

Thanks in advance for your help
Regards,
Pascal

Reply via email to