Robert,

.selectPath returns live objects from the original tree which was
executed on.
.execPath will always return new documents, sometimes copies of the
original.

In order to avoid loosing the results once you modify the document you
should:
1. run select path with a cursor: XmlCursor.selectPath()
2. iterate through results hasNextSelection(), toNextSelection()
        3. put bookmarks on selected places
4. move cursor to first bookmark
5. iterate through saved bookmarks
        6. modify xml

Cezar

> -----Original Message-----
> From: Robert W. Wade [mailto:[EMAIL PROTECTED]
> Sent: Monday, October 09, 2006 10:48 PM
> To: user@xmlbeans.apache.org
> Subject: Updating source doc after XPath search
> 
> I am trying to figure out if a way exists for me to accomplish the
> following:
> 
> - perform an XPath search against my main doc (xml doc A)
> - iterate through the results
> - periodically modify the xml values within the results
> - when i view xml doc A (that I performed the search on) I would like
> to see the data that I modified.
> 
> Reading the javadocs (and playing with the code), there are two ways
> to do XPath searches:
> 
> .selectPath() : performs the search OK, but when you modify the data
> it is not "persisted," so when I view xml doc A I do not see the
> updated data
> 
> .execQuery() : (according to the docs) it appears that the query
> would work, but the results would be copies of the data elements
> within my xml doc A. This means that if I update the results they
> won't be "persisted" in xml doc A.
> 
> If I am wrong about these two methods please let me know.
> 
> My fallback option is to manually iterate through my xml doc A and
> find the results myself. Not too cool.
> 
> Thanks
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

_______________________________________________________________________
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