Hi Daniel,
For converting a xalan node to a xerces DOMNode, the XercesDocumentWrapper
API has a mapNode function which is not there for the
XercesDOMWraperParsedSource (if i am correct).

So what I do is:

XPathEvaluator::initialize();
XPathEvaluator theEvaluator;
XercesDOMSupport theDOMSupport;
XercesDocumentWrapper theWrapper(theXercesDoc,
false,false,false);//theXerecesDoc is of type DOMDocument
XalanNode* xalContextNode = theWrapper.getDocumentElement();
 NodeRefList resultNodeList = theEvaluator.selectNodeList(theDOMSupport,
xalContextNode, XalanDOMString(XPathExpr.data(),XPathExpr.size()).c_str());

DOMNode* xerNode = (DOMNode*)(theWrapper.mapNode(resultNodeList.item(0)));

Hope this helps...

Ashay


-----Original Message-----
From: Gr�ndal Daniel [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 22, 2003 5:21 PM
To: [email protected]
Subject: create a DOMNode from XalanNode


Hi!!

I have a DOMtree in memory which I use with Xalan for xPath evaluations like
this:

// create DOM tree 'doc' and use it for other things.
//...

XPathEvaluator::initialize();
XPathEvaluator       eval;
XercesDOMSupport domsupport;
XercesParserLiaison parserLiaison;
const XercesDOMWrapperParsedSource parsedSource(doc parserLiaison,
domsupport);
XalanDocument* xalanDoc= parsedSource.getDocument();
XalanElement* rootElement= xalanDoc>getDocumentElement();
XalanNode* node = eval.selectSingleNode(domsupport,rootElement,
XalanDOMString(xpath.c_str()).c_str());

This should give me a pointer to one node, a XalanNode. I need to return a
DOMNode from the function. Is that possible and in that case, how do I do
that?

//daniel


Reply via email to