Ruby Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

Ruby
Examples

Quick Start
Unicode
Byte Array
Bz2
Certificates
CSV
Email
Encryption
FTP
HTML Conversion
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
Amazon S3
Email Object
DKIM / DomainKey
NTLM
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
Bzip2
DH Key Exchange
DSA
LZW

 

 

 

 

 

 

 

(Ruby) XML Parsing Example: Currency Data

Simple example showing how to parse an XML file containing currency data.

Downloads for Windows/Linux and Install Instructions

require 'chilkat'


xml = Chilkat::CkXml.new()

#  The Chilkat XML component is freeware.

#  Load an XML document.
#  This file is available at http://www.chilkatsoft.com/testData/currency.xml

success = xml.LoadXmlFile("c:/myXmlFiles/currency.xml")
if (success != true)
    print xml.lastErrorText() + "\n";
    exit
end

#  Iterate over each "CURRENCY" child node and display the contents:

n = xml.NumChildrenHavingTag("CURRENCY")
for i in 0 .. n - 1
    # curr is a CkXml
    curr = xml.GetNthChildWithTag("CURRENCY",i)
    print "----" + "\n";
    print "Name: " + curr.getChildContent("NAME") + "\n";
    print "Code: " + curr.getChildContent("CURRENCYCODE") + "\n";
    print "Country: " + curr.getChildContent("COUNTRY") + "\n";

end


 

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