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
Service
PPMD
Deflate
DH Key Exchange
DSA

Unreleased...
Bzip2
LZW
Bz2
Icon

 

 

 

 

 

 

 

Text Formatting Tags

Perl script showing how HTML text formatting tags are dropped by default during the HTML to XML conversion process. Text formatting tags may be kept by calling UndropTextFormattingTags.

Download Perl Programming Example Scripts

# file: TextFormattingTags.pl

use chilkat;

# Demonstrates how HTML text formatting tags are (by default) dropped
# during the HTML to XML conversion process.  To keep text formatting
# tags, call UndropTextFormattingTags

$htmlConv = new chilkat::CkHtmlToXml();
$success = $htmlConv->UnlockComponent("anything for 30-day trial");
if (! $success) {
	print "component is locked!\n";
	exit;
}

$html = "<html><body>This <b>is</b> a <i>test</i></body></html>";
	
# To convert, set the HTML and get the XML:
$htmlConv->put_Html($html);
$xml = $htmlConv->xml();
	
print $xml . "\n";


#		The output is this:
#		
#		<?xml version="1.0" encoding="utf-8" ?>
#
#		<root>
#		    <html>
#		        <body>
#		            <text>This  is a  test</text>
#		        </body>
#		    </html>
#		</root>
#		
#		
			
# What happened to the <b> and <i> tags???
# By default, text formatting tags are dropped.
# If we call UndropTextFormattingTags, the tags will remain:
$htmlConv->UndropTextFormattingTags();
	
$xml = $htmlConv->xml();

print $xml . "\n";
	
#		We now get this:
#		
#		<?xml version="1.0" encoding="utf-8" ?>
#
#		<root>
#		    <html>
#		        <body>
#		            <text>This </text>
#		            <b>
#		                <text>is</text>
#		            </b>
#		            <text>a </text>
#		            <i>
#		                <text>test</text>
#		            </i>
#		        </body>
#		    </html>
#		</root>
			




 

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

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