Hello all,

I'm a bit stuck in trying to achieve this with XmlObjects and XmlCursor.
Imagine the following scenario:

<parent>
    <child>Some text</child>
</parent>

I want to insert a new element AFTER the child element.

<parent>
    <child>Some text</child>
    <!-- New element here! -->
</parent>

I don't necessarily know anything about the child element. It might have
child text like the example above. It might not. It might have child
elements, it might not. It might have siblings, it might not. Here's where
I'm stuck:

// XmlObject representing parent.
XmlObject parent = ...;

XmlCursor parentCursor = parent.newCursor();

// Now I'm at the START token for the child element.
parentCursor.toChild("child");

>From here, how do I reliably get the cursor past </child> or <child/>?
Basically I'm at the start of <child> and want to be right past the end of
that element.

Thanks,

Michael

Reply via email to