Perl Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript



Perl Examples

Quick Start
Perl Unicode
Perl Byte Array
Perl Certs
Perl Email
Perl Encryption
Perl FTP
HTML-to-XML
Perl HTTP
Perl IMAP
Perl MHT
Perl MIME
Perl RSA
Perl S/MIME
Perl Signatures
Perl Socket
Perl Spider
Perl Tar
Perl Upload
Perl XML
Perl XMP
Perl Zip

More Examples...
String
Email Object
POP3
SMTP
RSS
Atom
Self-Extractor

Unreleased...
Service
PPMD
Deflate
Bzip2
LZW
Bz2
DH Key Exchange
DSA
Icon

 

 

 

 

 

 

 

Iterate and Delete

Iterate over XML child nodes, deleting each child while iterating.

Download Perl Programming Example Scripts

# file: xmlDeleteNodes.pl

use chilkat;

# The Chilkat XML parser is freeware.
	
# Simple Perl XML example to iterate over child nodes deleting each while
# in progress.
$xml = new chilkat::CkXml();

# Create this XML:
# <?xml version="1.0" encoding="utf-8" ?>
# <colors>
#         <color>red</color>
#         <color>blue</color>
#         <color>green</color>
#         <color>yellow</color>
#         <color>purple</color>
#         <color>orange</color>
# </colors>

# First create the XML:
$xml->put_Tag("colors");
$xml->NewChild2("color","red");
$xml->NewChild2("color","blue");
$xml->NewChild2("color","green");
$xml->NewChild2("color","yellow");
$xml->NewChild2("color","purple");
$xml->NewChild2("color","orange");
$xml->SaveXml("output/colors.xml");

# Load the XML and iterate/delete:
$xml2 = new chilkat::CkXml();
$xml2->LoadXmlFile("output/colors.xml");

while ($xml2->get_NumChildren() > 0)
{
	$child = $xml2->GetChild(0);
	print $child->content . "\n";
	$child->RemoveFromTree();
}






 

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2007 Chilkat Software, Inc. All Rights Reserved.