xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David_N_Bert...@lotus.com
Subject Re: deleting a XalanNode
Date Sun, 21 Jan 2001 14:45:59 GMT

I don't understand what you mean by the "XalanDom".  There is no such
thing.  There is a collection of abstract base classes in the XalanDOM
subsystem, but there is no implementation.

If you are using an instance Xalan's XercesParserLiaison to wrap the Xerces
DOM, or you're using the XalanSourceTree, then you are not allowed to
delete nodes that belong to a document.  The document owns the nodes and
deletes them when the document itself is deleted.  The reason you're
getting a set fault is because the nodes are not allocated by new, so using
delete results in undefined behavior.

If you've created a document yourself, you are responsible for deleting the
document.  If you created it through a XercesParserLiaison instance, then
that instance owns the document and will delete when it is reset, or it
goes out of scope.


                    "Lyle Coder"                                                         
                    <x_coder@hotm        To:     <general@xml.apache.org>       
                    ail.com>             cc:     (bcc: David N Bertoni/CAM/Lotus)     
                                         Subject:     deleting a XalanNode               
                    06:52 PM                                                             
                    respond to                                                           

I have a function called xalan_free which walks the XalanDom in post order
freeing at the end of the walk like this:

void xalan_free(XalanNode *node)

    if (node->getNextSibling())

    if (node->getNodeType() != XalanNode::DOCUMENT_NODE)

    delete node;

problem is I get a seg fault at the delete... can some one tell me what I'm
doing wrong?


In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org

View raw message