Here is what I do:
void doXpath(xercesc_2_7::DOMElement* theElem, xercesc_2_7::DOMDocument*
theDoc)
{
XALAN_CPP_NAMESPACE::XercesDocumentWrapper* theWrapper;
XALAN_CPP_NAMESPACE::XercesDOMSupport* theDOMSupport;
XALAN_CPP_NAMESPACE::XercesParserLiaison* theParserLiaison;
const XALAN_CPP_NAMESPACE::XercesDOMWrapperParsedSource* theParsedSource;
theDOMSupport = new XercesDOMSupport();
theParserLiaison = new XercesParserLiaison(*theDOMSupport);
theParserLiaison->setBuildWrapperNodes(true);
theParserLiaison->setBuildMaps(true);
theDoc->normalize();
theParsedSource = new XercesDOMWrapperParsedSource(
theDoc,
*theParserLiaison,
*theDOMSupport);
theWrapper =
theParserLiaison->mapDocumentToWrapper(theParsedSource->getDocument());
XalanNode* myXalanNode = theWrapper->mapNode(theElem);
/* ..... */
}
Everything seems to works fine, exept for that mapNode, which return
NULL (if I use it to map a node from xalanNode to DOMElement it goes well).
Any clue?
Thanks in advance.
David Bertoni wrote:
Antonio Scotti wrote:
Hi! I've a problem using a XercesDocumentWrapper.
I've a Xerces DOMDocument and I'd like to evaluate an xpath expression
on a specific DOMElement.
What I've done is to build a XercesDOMWrapperParsedSource (using the
DOMElement, a XercesParserLiaison and a XercesDOMSupport).
Then I got a XercesDocumentWrapper from the XercesParserLiaison (using
mapDocumentToWrapper).
Now.. to get the specific XalanNode* to use as context node for the
evaluate, I've tried using the mapNode method of the
XercesDocumentWrapper passing the DOMElement as a parameter.
I got no errors but the result is NULL.
I don't get what am I doing wrong.
Can someone please help?
Can you please post some source code so we can see what you're doing.
Preferably, a complete, _minimal_ sample.
Dave