Hi,

Thanks David for your quick reply.

>From your description I can see the third solution is more suitable as
this could manipulate the nodes and update the original DOM and thus the
original xml.

As I've just started my xerces/xalan coding, it would be greatful if you
could point any samples for this. 

Thanks,
Arun Ramachandran.

-----Original Message-----
From: David Bertoni [mailto:dbert...@apache.org] 
Sent: Friday, May 22, 2009 4:28 PM
To: xalan-c-users@xml.apache.org
Subject: Re: Manipulating the xpath expression to reflect the data
modified in the original xml.

ramachandran_a...@emc.com wrote:
>> Hi,
>>
>> I'm using xerces-C++ [version-2.7.0] and xalan-c++ [version-1.10.0]
in
>> my application.
>>
>> AIM: Open an xml, query the xpath expression to get the nodes and
>> change the values provided by user in a seperate structure in the
>> nodes evaluated from the xpath query. I could get the xml node
related
>> to the xpath expression in a XObjectPtr. I can see samples how to
read
>> the data to display from this xpath evaluation. But I'm not sure
about
>> how to manipulate the data and put it back into the original xml.
XPath does not have any "write" semantics, so you cannot use XPath to do

this.  You might consider using an XQuery implementation like Xqilla on 
top of the Xerces-C DOM.

Another choice is to express the modifications as an XSLT stylesheet 
that you generate using the XPath expressions.  That could become very 
complicated, unless you want to limit the complexity of the XPath 
expressions you allow.

A third choice is to use the Xerces-C DOM, and Xalan-C's wrapper around 
it to find nodes in the Xerces-C DOM using XPath expressions.  You can 
then modify the underlying DOM as appropriate.

All of these choices have pluses and minuses.  Because your initial 
problem description is very vague, it's difficult to say what would be 
the best choice.

Dave

Reply via email to