You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Shang, Crystal" <Cs...@rsasecurity.com> on 2002/04/19 23:53:37 UTC

appendChild in Xalan

Hi,

I'm trying to create a DOM tree in memory and dump the result to an XML file
using FormatterToXML and FormatterTreeWalker. Somehow when I call
appendChild to append the result of XPath evaluation( ELEMENT_NODE ) to the
tree, the code crashes:

{
	...
	XercesDOMSupport    	domSupport;
	XercesParserLiaison 	parserLiaison(domSupport);

          	XalanDocument*      	xDocument   =
parserLiaison.createDocument();
          
          	XalanElement *      	parentEle  =
xDocument->createElement(XalanDOMString("Parent"));
    
          	xDocument->appendChild( parentEle );          	
          	parentEle->appendChild((XalanNode *)theNode);  <--- crashes
here         
	...
}   

theNode is a valid element node retrieved from the nodelist of XPath
evaluation, if I just use FormatterTreeWalker::traverseSubtree(theNode), I
am able to save this into a valid XML file. However, when I add this to be a
part of a DOM tree, it crashes. Can you let me know what I should do?

Thanks in advance,

- Crystal


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org