Ruby Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript



Ruby
Examples

Quick Start
Unicode
Byte Array
Bz2
Certificates
CSV
Email
Encryption
FTP
HTML-to-XML
HTTP
IMAP
MHT
MIME
POP3
RSA
S/MIME
Signatures
SFTP
SMTP
Socket / SSL
Spider
SSH
SSH Key
SSH Tunnel
Tar
HTTP Upload
XML
XMP
Zip

More Examples...
String
Email Object
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
Bzip2
DH Key Exchange
DSA

Unreleased...
LZW
Icon

 

 

 

 

 

 

 

Iterate over Child Nodes

Iterate over the children of an XML node.

Download Ruby Programming Example Scripts

# file: xmlChildIterate.rb
# 
# Iterate over child nodes in a document using FirstChild/NextSibling.

require 'chilkat'

# The Chilkat XML parser for Ruby is freeware.  The code demonstrated in this
# example can be used in both commercial and non-commercial applications without 
# restriction.  

# The Chilkat XML Ruby examples utilize these online XML data samples:
# http://www.chilkatsoft.com/xml-samples/bookstore.xml
# http://www.chilkatsoft.com/xml-samples/nutrition.xml
# http://www.chilkatsoft.com/xml-samples/pigs.xml
# http://www.chilkatsoft.com/xml-samples/plants.xml
# http://www.chilkatsoft.com/xml-samples/japanese.xml
# http://www.chilkatsoft.com/xml-samples/hamlet.xml
    
xml = Chilkat::CkXml.new()
xml.LoadXmlFile("plants.xml")

# Iterate over each "PLANT" under the "CATALOG" node.
# (The CATALOG node is the root node of the document...)
commonName = Chilkat::CkString.new()

plant = xml.FirstChild()
while plant != nil
	plant.GetChildContent("COMMON",commonName)
	print commonName.getString() + "\n"
	plant = plant.NextSibling()
end






 

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

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