Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
(Ruby) XML Parsing Example: Currency DataSimple 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.