views:

1184

answers:

2

I am supporting a legacy C++ application which uses Xerces-C for XML parsing. I've been spoiled by .Net and am used to using XPath to select nodes from a DOM tree.

Is there any way to get access some limited XPath functionality in Xerces-C? I'm looking for something like selectNodes("/for/bar/baz"). I could do this manually, but XPath is so nice by comparison.

A: 

According to the FAQ, Xerces-C supports partial XPath 1 implementation:

The same engine is made available through the DOMDocument::evaluate API to let the user perform simple XPath queries involving DOMElement nodes only, with no predicate testing and allowing the "//" operator only as the initial step.

You use DOMDocument::evaluate() to evaluate the expression, which then returns a DOMXPathResult.

Jeff L
Has anyone used this functionality? Has it worked? If so, for what versions of Xerces-C?
Adam Tegen
+1  A: 
Matt H