Hi, Dave
I replaced the XalanSourceTreePraserLiaison with the XercesParserLiason and
then I do succeeded in deleting the Node.
 
Now I wanted to see that the XalanDocument * returned by the
XercesParserLiaison::createDocument  was update (the nodes where removed ) 
so I did the same as in the serialize example 
        I created XalanStdOutputStream ,XalanOutputStreamPrinterWriter,
FormatterToXML, and FormaterTreeWalker
        I called FormatterToXML::startDocument
        I created nodeList using the evaluator
        I used the FormatterTreeWalker::traverseSubtree 
        and Finally I I called FormatterToXML::endDocument

What amazed me was that I saw the Nodes that I removed already on the
screen?
then I tried to remove the same Node that were already removed again and I
got an exception that they do not exist.
so what's going on?
I thought that may be the nodes are only marked as been deleted am I right?

I need to send the updated document to another application as a stream
buffer Where can I find an example for that?
I scanned the archive and I did not found something that can help me.

Regards
Ifat

 
 

-----Original Message-----
From: David N Bertoni/Cambridge/IBM [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 26, 2002 11:54 PM
To: [email protected]
Subject: Re: removeChild of xalanNode (found by xpath) from parsed xml file
throw XalanDomExeption



Ifat,

Please try to limit the size of your post to something more reasonable.
This is quite a bit of code, and a smaller example is much easer to
understand.

> void myDom::removeNode(string xpath){
>   cout <<"-------------removeNode start " <<endl;
>   try{
>     XalanNode * xpathNode=this->getNode(_evaluatorI,xpath);
>     cout << "parent node type=" <<
> xpathNode->getParentNode()->getNodeType()<< endl;
>     cout << "parent node name=" <<
> xpathNode->getParentNode()->getNodeName()<< endl;
>     (xpathNode->getParentNode())->removeChild(xpathNode);
>     cout << "remove child finished" <<endl;
>     cout <<"-------------removeNode finished " <<endl;
>   }
>   catch (const XalanDOMException & e) {
>     cout << "XalanDomExeption was thrown code=" << e.getExceptionCode()
> <<endl
>             << e.getMessage().c_str() <<endl
>             << e.getType().c_str() <<endl
>             << e.getLineNumber <<endl
>             << e.getColumnNumber() <<endl;
>     throw;
>   }
>   catch(...){
>     cout << "Exeption was thrown" <<endl;
>     throw;
>   }
> }

The tree that Xalan builds is not mutable.  If you check the error code in
the XalanDOMException instance, you'll see that it's
NO_MODIFICATION_ALLOWED_ERR.  If you want to do this sort of thing, you'll
need to use the Xerces DOM and our wrapper around their DOM.  There is more
information in the documentation and you'll find lots of discussion about
this in the mail archives.

>   XalanDocument * _xalanDocument;//not been deleted at the distructor
since
> ParserLiaison owns it
>  XalanNode * _contextNode;//not been deleted at the distructor since
delete
> cause segmentation fault-way?

Because the document owns it, and it's destroyed when the document is
destroyed.

...

> hope some one can help
> regards
> Ifat Tankel

Dave

Reply via email to