Re: Deleting a Node
by Chilkat Software other posts by this author
Nov 13 2006 9:36AM messages near this date
view in the new Beta List Site
Re: Deleting a Node
|
RE: [BULK] - Re: Deleting a Node
& XSLT I created an example using the Chilkat XML parser (freeware) here:
http://www.example-code.com/perl/perl-xml-iterate-delete.asp
The code to iterate and delete looks like this:
# Load the XML and iterate/delete:
$xml2 = new chilkat::CkXml();
$xml2-> LoadXmlFile("colors.xml");
while ($xml2-> get_NumChildren() > 0)
{
$child = $xml2-> GetChild(0);
print $child-> content . "\n";
$child-> RemoveFromTree();
}
I'll be happy to more examples upon request (so long as they
are somewhat generic to be of use to others).
Best Regards,
Matt Fausey
Chilkat Software, Inc.
At 11:16 AM 11/13/2006, Mesdaq, Ali wrote:
> I am using xml to keep a list of items I need to loop through. But I
> would like to delete the items as I am looping through. So in case if
> the system crashes and I boot back up I know where to continue from. So
> now a few questions I have regarding that.
>
> One is what do I use to delete the node? I was looking through the
> documentation for libxml on cpan and I see "replaceNode" in the
> XML::LibXML::Node library but it seems like it keeps a copy around which
> seems to be a little inefficient. I am pretty sure there is probably a
> better function for this but I couldn't find it and I would imagine it
> would be in the XML::LibXML::Node library.
>
> Second question is about the reliability of either the replaceNode call
> or whatever the better function call is. How reliable is that call? If I
> call that is there a chance the document could be in a non-valid state?
> Or will that call ensure that it only deletes that node and not delete
> it partially?
>
> Thanks in advance.
> _______________________________________________
> Perl-XML mailing list
> Perl-XML@[...].com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.409 / Virus Database: 268.14.3/531 - Release Date: 11/12/2006
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.14.3/531 - Release Date: 11/12/2006
_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Ali Mesdaq
Liam Quin
Bruce Miller
Chilkat Software
Ali Mesdaq
Robin Berjon
Ali Mesdaq
Bruce Miller
Ali Mesdaq
Bruce Miller
Ali Mesdaq
John Saylor
|