You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Jatayu <ja...@gmail.com> on 2008/06/25 18:02:24 UTC
using xpath to locate and modify node?
Hi,
I'm using xerces-c 3.0.0 beta to experiment on how I can use its xpath
feature.
Does anyone know if it's possible to use XPATH to locate a node in the DOM,
then do *modification* on that returned node, e.g: add new children to that
node?
Something like:
DOMXPathResult* xpathRes = (DOMXPathResult*)theDoc->evaluate(......);
But the "getSingleNodeValue<file:///u:/DataFpinitTier2_2/cgunadi/xml/xerces_3.0.0_linux24_amd64/xerces-c-3.0.0.b1/doc/html/apiDocs-3/classDOMXPathResult.html#745a4f5efb935a988d0b4ca6a46c0b0e>()"
function on DOMXPathResult returns
a *const* node.
Is it safe to cast away the const and add new children/change value
of the node?
Is there different way to accomplish this?
Thank you very much for any inputs.
Regards,
= Jatayu
Re: using xpath to locate and modify node?
Posted by Jatayu <ja...@gmail.com>.
Hi Boris,
Thank you again. This is very helpful.
= Jatayu
On Wed, Jun 25, 2008 at 1:06 PM, Boris Kolpackov <bo...@codesynthesis.com>
wrote:
> Hi Jatayu,
>
> Jatayu <ja...@gmail.com> writes:
>
> > Does anyone know if it's possible to use XPATH to locate a node in the
> DOM,
> > then do *modification* on that returned node, e.g: add new children to
> that
> > node?
>
> Yes, that a pretty reasonable thing to do.
>
>
> > function on DOMXPathResult returns a *const* node.
>
> This has been fixed in SVN. The second beta (coming out in a few
> weeks) will have this change.
>
> > Is it safe to cast away the const and add new children/change value
> > of the node?
>
> Yes, that's what you can do in the meantime.
>
> Boris
>
> --
> Boris Kolpackov, Code Synthesis Tools
> http://codesynthesis.com/~boris/blog<http://codesynthesis.com/%7Eboris/blog>
> Open source XML data binding for C++:
> http://codesynthesis.com/products/xsd
> Mobile/embedded <http://codesynthesis.com/products/xsdMobile/embedded>validating XML parsing:
> http://codesynthesis.com/products/xsde
>
Re: using xpath to locate and modify node?
Posted by Boris Kolpackov <bo...@codesynthesis.com>.
Hi Jatayu,
Jatayu <ja...@gmail.com> writes:
> Does anyone know if it's possible to use XPATH to locate a node in the DOM,
> then do *modification* on that returned node, e.g: add new children to that
> node?
Yes, that a pretty reasonable thing to do.
> function on DOMXPathResult returns a *const* node.
This has been fixed in SVN. The second beta (coming out in a few
weeks) will have this change.
> Is it safe to cast away the const and add new children/change value
> of the node?
Yes, that's what you can do in the meantime.
Boris
--
Boris Kolpackov, Code Synthesis Tools http://codesynthesis.com/~boris/blog
Open source XML data binding for C++: http://codesynthesis.com/products/xsd
Mobile/embedded validating XML parsing: http://codesynthesis.com/products/xsde