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
(Perl) XML Parsing Example: Currency DataSimple example showing how to parse an XML file containing currency data.
use chilkat(); $xml = new chilkat::CkXml(); # 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 != 1) { print $xml->lastErrorText() . "\r\n"; exit; } # Iterate over each "CURRENCY" child node and display the contents: $n = $xml->NumChildrenHavingTag("CURRENCY"); for ($i = 0; $i <= $n - 1; $i++) { # curr is a CkXml $curr = $xml->GetNthChildWithTag("CURRENCY",$i); print "----" . "\r\n"; print "Name: " . $curr->getChildContent("NAME") . "\r\n"; print "Code: " . $curr->getChildContent("CURRENCYCODE") . "\r\n"; print "Country: " . $curr->getChildContent("COUNTRY") . "\r\n"; } |
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.