Hi Ashay! Well, what can I say. That did the job. So it seems anyway. Thank's a lot.
I have somehow put myself in the position where I have parsed a xml-file with and have a DOM-tree in memory and then want to select nodes, remove nodes etc. using xpath's. Xerces can't handle xpaths that good. So I have to wrap everything and use Xalan. To make things even more complicated I want to return nodes as if they were found using the DOM-api. *puh* =) //daniel Ashay Shende (2003-07-22 14:53): >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 > > ------------------------------------------------------------------ RFV Data E-post: [EMAIL PROTECTED] Utvecklingsenheten/Grupp 2 Tfn: 060-187126 S.a J�rnv�gsgatan 41 Mobil: 070-3016517 851 93 Sundsvall Fax: 060-147870 ------------------------------------------------------------------
