You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by George Powers <Ge...@packeteer.com> on 2004/10/05 18:42:08 UTC

modifying XalanDocument nodes

I'm trying to read an XML document, find and modify some elements, and write it again as XML.  This worked OK using just Xerces, but then I was inspired to try XPath searches with Xalan-c, and I'm perplexed.  I can wrap a Xerces doc in a XalanDocument, and do the XPath search, but then I can't modify the XalanDocument.  Since the search returns XalanDocument references, I can't modify the original Xerces doc either.

Is there any way to make Xalan-c support editing a document this way, or am I barking up the wrong tree?  I've already tried using XercesDOMWrapperParsedSource(), but (as mentioned) I can't modify the wrapped document.  Would I be better off with Pathan?

Thanks,

George

Re: modifying XalanDocument nodes

Posted by da...@us.ibm.com.
> I'm trying to read an XML document, find and modify some
> elements, and write it again as XML.  This worked OK using
> just Xerces, but then I was inspired to try XPath searches
> with Xalan-c, and I'm perplexed.  I can wrap a Xerces doc
> in a XalanDocument, and do the XPath search, but then I can't
> modify the XalanDocument.  Since the search returns
> XalanDocument references, I can't modify the original Xerces
> doc either.

You can recover the corresponding Xerces-C nodes from the Xalan-C nodes 
returned from executing an XPath expression.

> Is there any way to make Xalan-c support editing a document
> this way, or am I barking up the wrong tree?  I've already
> tried using XercesDOMWrapperParsedSource(), but (as mentioned)
> I can't modify the wrapped document.  Would I be better off
> with Pathan?

Search the list archives and you'll find plenty of information on how to 
do this.  If you don't find what you're looking for, just post another 
question.

Dave