Think about the XmlCursor as a cursor in a text editor. If the cursor is
on the startelement of <b/>, what you insert comes right before b, if
you want to insert something right before the endelement of <b/> do
cursor.toEndToken() before doing cursor.beginElement(). You may also
want to look at cursor.insertElement() if you plan to add content to
<d/>. This will insert the element and move the cursor such that the
next insert happens inside of <d/>.

Radu

On Tue, 2008-03-04 at 09:51 -0700, Pascal Maugeri wrote:
> Hi
> 
> I have the following document:
> 
> <a>
>   <b>
>     <c/>
>   </b>
> </a>
> 
> When I move my XmlCursor to <b> child (in this case <c/>) and add a
> new child <d/> with cursor.beginElement() I get a the correct result:
> 
> <a>
>   <b>
>     <d/>
>     <c/>
>   </b>
> </a>
> 
> But now if the original document is (no child under <b/> yet):
> 
> <a>
>   <b/>
> </a>
> 
> How can I insert my <d/> has a new child of <b/> once I have moved my
> cursor to <b/> ?
> 
> So far I only managed to have my <d/> before <b/> :-(
> 
> Regards,
> Pascal

Notice:  This email message, together with any attachments, may contain 
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated 
entities,  that may be confidential,  proprietary,  copyrighted  and/or legally 
privileged, and is intended solely for the use of the individual or entity 
named in this message. If you are not the intended recipient, and have received 
this message in error, please immediately return this by email and then delete 
it.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to