Ruby Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript



Ruby
Examples

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

More Examples...
String
Email Object
POP3
SMTP
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
Bzip2
DH Key Exchange
DSA
SSH Key
SSH
SSH Tunnel
SFTP

Unreleased...
LZW
Bz2
Icon

 

 

 

 

 

 

 

Drop HTML Tag Types

Ruby example to demonstrate how specific HTML tag types may be dropped during the HTML to XML conversion process.

Download Ruby Programming Example Scripts

# file: DropTagType.rb

require 'chilkat'

# Demonstrates how specific HTML tags can be selected to be dropped
# during the HTML to XML conversion process.

htmlConv = Chilkat::CkHtmlToXml.new()
success = htmlConv.UnlockComponent("anything for 30-day trial")
if not success
	print "component is locked!"
	exit
end

html = "<html><body><span>This <b>is</b> a <i>test</i><hr></span></body></html>"
	
# First, call UndropTextFormattingTags to prevent the text formatting tags
# from being dropped by default.
htmlConv.UndropTextFormattingTags()

# We'll want to drop <hr>, <i>, and <span> tags:
htmlConv.DropTagType("hr")
htmlConv.DropTagType("i")
htmlConv.DropTagType("span")

# To convert, set the HTML and get the XML:
htmlConv.put_Html(html)
xml = htmlConv.xml()

print xml


#	The output is this:
#	
#	<?xml version="1.0" encoding="utf-8" ?>
#
#	<root>
#	    <html>
#	        <body>
#	            <text>This </text>
#	            <b>
#	                <text>is</text>
#	            </b>
#	            <text>a  test</text>
#	        </body>
#	    </html>
#	</root>	
			



 

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

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