You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by "Tankel, Ifat" <If...@icomverse.com> on 2002/03/10 17:51:59 UTC

append new xalanNode taken from other Xalan Document to my XalanN ode

Hi
I want to take new XalanNode *from otherXalanDocument and append it to old
XalanNode in myXalanDocument
the XalanNode I have is XercesElementBridge * and that the XalanDocument is
XalanDocumentBridge *

when I wrote 
void myDom::addNode(string thisDomXpath,myDom & otherDom ,string
otherDomXpath){
   XalanNode * newNode=otherDom.getNode(_evaluatorI,otherDomXpath); //
getNode use evaluator to retrieve XalanNode which is XercesElementBridge
   XalanNode * oldNode=getNode(_evaluatorII,thisDomXpath); 
   oldNode->appendChild(_xalanRealDoc[0]->importNode(newNode,true)); //
_xalanRealDoc[0] is XalanDocumet * returned by
XercesParserLiaison->createDocument(DomDoc) 
}
I got exception not supported // because XalanDocumentBridge::importNode is
not supported   ...... so I wrote 

void myDom::addNode(string thisDomXpath,myDom & otherDom ,string
otherDomXpath){
   XalanNode * newNode=otherDom.getNode(_evaluatorI,otherDomXpath); 
   XercesDocumentBridge * newXercesDoc= dynamic_cast <XercesDocumentBridge
*> (otherDom.getRealXalanDoc());
   DOM_Node newDOMNode= newXercesDoc->mapNode(newNode);

   XalanNode * oldNode=getNode(_evaluatorII,thisDomXpath);
   XercesDocumentBridge * oldXercesDoc=dynamic_cast <XercesDocumentBridge *>
(_xalanRealDoc[0]);
   DOM_Node oldDOMNode=oldXercesDoc->mapNode(oldNode);

   oldDOMNode.appendChild(_domDocument->importNode(newDOMNode,true));
    // to see my changes I need the next steps
   _parserLiaison->destroyDocument(_xalanRealDoc[0]);
   _xalanRealDoc[0]=_parserLiaison->createDocument(*_domDocument);
} 
must it be like that ? Is there any other way to do it?
Regards
Ifat
 
p.s 
class myDom{
public: ...
	  const string getValue(string xpath);
	  XalanNode* getNode(XPathEvaluator * evaluator,string xpath="/");
	  void addNode(string thisDomXpath,myDom & otherDom ,string
otherDomXpath);
	  XalanDocument * getRealXalanDoc();
private:   static DOMParser * _domParser;
	  static XercesDOMSupport * _domSupport;
	  static XercesParserLiaison * _parserLiaison;
	  static XPathEvaluator * _evaluatorI;
	  static XPathEvaluator * _evaluatorII;
	  DOM_Document * _domDocument;
	  vector<XalanDocument *> _xalanRealDoc;
	... };
 <<...OLE_Obj...>> 
ifat.tankel@comverse.com
Comverse Divisional Developer
03-6454768
053-762891