Thanks for replying Jacob.
I tried cursor.child(1) but it returns false. (child index 1 anyway
represents the second child of the current cursor position and i need to
select the first child). This is what i am inferring from the behavior of
the api:

When i start with the XmlObject that represents the untyped document, the
first child under it is an xml-fragment containing the contents of the root
element. But this does not make sense. It might make perfect sense perhaps
if I had started with a schema and declared things like this:

<xs:complexType name="ElemT">
...
</xs:complexType>
<xs:element name="RootElem" type="ElemT"/>

But I have doubts about this even for typed XmlObject, because it might be
right if i am trying to get to the next token, but next child should always
be a concrete node as per my understanding.

This assumption/inference is proved wrong when i try to move to the first
child of this xml-fragment, it actually takes me to the subsequent child, so
child navigation is correct the contents of the intermediate child are
incorrect.

I will try to explain in problem with the tree.
RootElement 
        -> Level1.1 
                -> Level2-1.1
        -> Level1.2
                -> Level2-1.2
        -> Level1.3
                -> Level2-1.3
First cursor.toChild(0) should return Level1.1 but instead it returns all
the children of Root inside an xml-fragment. Dont know if this is expected
behavior but it does not match the behavior of the next call to
cursor.toChild(0) since it correctly returns Level2-1.1. So although the
first time the cursor was pointing to Level1.1, it somehow returned wrong
XML fragment in cursor.getObject();

When i use an XML with single child for each parent it works fine (no
siblings at any level). It returns Level1.1 in the first call and Level2-1.1
in the next call, so on and so forth.

regards
kapil
-- 
View this message in context: 
http://www.nabble.com/Navigating-Untyped-XmlObject-with-XmlCursor-tp22463857p22464836.html
Sent from the Xml Beans - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@xmlbeans.apache.org
For additional commands, e-mail: user-h...@xmlbeans.apache.org

Reply via email to