ramachandran_a...@emc.com wrote:
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.
There has been a fair amount of discussion of this in the past on both the developer and the user lists. I suggest you take a look at the archives. Search terms like "Xerces wrapper" should pull up some relevant discussions.

Some key points:

1. You will need to wrap the existing Xerces-C DOM instance with a set of Xalan-C wrappers. There is done using the XercesParserLiaison::createDocument().

2. You will also want to set the options to build the full mapping relationship. See XercesParserLiaion::setBuildMaps().

3. It's best to build the full set of wrappers at once, rather than to have them create on-demand. See XercesParserLiaion::setBuildWrapperNodes()

4. Once you make a modification to the document instance, you must destroy and rebuild the wrapper before you attempt more XPath evaluations. You can do this through XercesParserLiaison::destroyDocument().

5. You can map between Xalan-C nodes and Xerces-C nodes using XercesParserLiaison::mapDocumentToWrapper() to map the XalanDocument instance to the underlying XercesDocumentWrapper instance. XercesDocumentWrapper::mapNode() will then returning the underlying Xerces-C DOM node instance, and you can operator on it.

6. For serialization, use the existing Xerces-C DOM serializer. For more information on that, see the Xerces-C DOMPrint sample application.

Dave

Reply via email to