I have some problem with using XalanElement::getElementByTagName(..).
It returns NULL although having nodes.
And another problem is below.
My code is like this ;

---------------------------------------

void PrintXalanDOM(XalanNode* theNode)
{
        ASSERT(theNode) ;
        XalanStdOutputStream   theStream(cout);
         XalanOutputStreamPrintWriter thePrintWriter(theStream);

         FormatterToXML   theFormatter(thePrintWriter);
         FormatterTreeWalker  theWalker(theFormatter);

         // Don't write a header...
         theFormatter.setShouldWriteXMLHeader(false);

         // It's required that we do this...
         theFormatter.startDocument();

        theWalker.traverseSubtree(theNode);

         // It's required that we do this...
         theFormatter.endDocument();
}

void main()
{
        // initialize Xerces & Xalan
                ....

        // Parse the document by XercesDOMSupport & XercesParserLiaison, and 
get XalanDocument* doc
                ....

        XalanElement* root = doc->getDocumentElement() ;
        PrintXalanDOM(root) ;  // print a source document, no problem

        XalanNodeList* nl = root->getElementsByTagName(XalanDOMString("*")) ; 
// <-- Problem
        assert(nl != NULL) ;  // nl is NULL, so assertion failure!!

                ....

        XalanElement* element = root->createElement(XalanDOMString("Test")) ;
        root->appendChild(element) ;
        PrintXalanDOM(root) ;  // <-- Problem (print a source document not a 
changed document)
        
                ....
}

Reply via email to