Return-Path: Mailing-List: contact general-help@xml.apache.org; run by ezmlm Delivered-To: mailing list general@xml.apache.org Received: (qmail 81366 invoked from network); 21 Jan 2001 21:28:52 -0000 Received: from oe29.law4.hotmail.com (HELO hotmail.com) (216.33.148.22) by h31.sny.collab.net with SMTP; 21 Jan 2001 21:28:52 -0000 Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Sun, 21 Jan 2001 13:28:32 -0800 X-Originating-IP: [63.197.4.216] From: "Lyle Coder" To: References: Subject: Re: deleting a XalanNode Date: Sat, 6 Jan 2001 04:57:38 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 Message-ID: X-OriginalArrivalTime: 21 Jan 2001 21:28:32.0372 (UTC) FILETIME=[1AA48340:01C083F1] X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N Hi, The nodes are created using XalanDocument::createElement(). So can I just delete the document root pointer and expect th eentore tree to be free'd up? Can I say delete node where node is a XalanDocument * created using ParserLiaison::createDocument() Thanks Lyle ----- Original Message ----- From: To: Sent: Sunday, January 21, 2001 6:45 AM Subject: Re: deleting a XalanNode > > 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. > > Dave > > > > > "Lyle Coder" > > ail.com> cc: (bcc: David N Bertoni/CAM/Lotus) > Subject: deleting a XalanNode > 01/05/2001 > 06:52 PM > Please > respond to > general > > > > > > Hi, > 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->hasChildren()) > xalan_free(node->getFirstChild()); > > if (node->getNextSibling()) > xalan_free(node->getNextSibling()); > > if (node->getNodeType() != XalanNode::DOCUMENT_NODE) > node->getParentNode()->removeChild(node); > > delete node; > } > > problem is I get a seg fault at the delete... can some one tell me what I'm > doing wrong? > > Thanks > Lyle > > --------------------------------------------------------------------- > 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 > > > > > > > --------------------------------------------------------------------- > 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 > >