Thank you, Peter. I have already done something similar, but instead of using the XERCES-DOM i wrote my own implementation of the XALAN-DOM ( actually, i took the XalanSourceTree and modified it a little ).
-----Original Message----- From: Peter Murphy [mailto:[EMAIL PROTECTED]] Sent: Freitag, 9. November 2001 04:04 To: [EMAIL PROTECTED] Subject: RE: Xerces-C XPath module > -----Original Message----- > From: Cornelius, Martin [mailto:[EMAIL PROTECTED]] > > IMHO, of course there is a need for this: There are many imaginable > applications that need XPath to navigate documents but do not > need XSLT. It may be possible to use the XALAN XPath component to navigate > Xerces DOMs ( i haven't tried yet ), but it looks like a rather bloated task and requires > much more elaborated C++ features than XERCES ( STL...). I've actually used Xalan's XPath on Xerces DOM nodes. The amount of code is not that big, although one may need to tweak it a bit. You import a Xerces document into Xalan's own DOM hierarchy using their XercesDocumentBridge class. (Their DOM is separate from the Xerces DOM for performance reasons, I understand.) You map the node you want to use as a context node from Xerces to Xalan. You execute an XPath expression on the context node. Any individual node in a XPath nodeset can be mapped from Xalan to Xerces easily. I can deliver a code sample if you want. You can extract strings, numbers, booleans and individual nodes as you would expect from XPath. The only hassle is in forming NodeSets (NOT NodeLists) containing Xerces nodes. You might have to roll your own class for those. My initial idea was to form a Xerces Document Fragment, and cloning the resulting nodes as children. But this doesn't quite work: document nodes, attribute nodes and namespace nodes (also interpreted as attribute nodes in Xerces) cannot be added as child nodes to document fragments. (I think this is different from Xalan-J, where there exists an instruction to transform Xalan NodeSets into Xerces NodeLists. In C++, I had to write a "for" loop explicitly.) Regards, Peter. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
