Parsing an XML Document the Easy Way
Once you've read an XML document into memory, like this...
var xmlDocHolder = new ActiveXObject("MSXML2.DOMDocument")
xmlDocHolder.load("http://www.davidwall.com\countryList.xml")
...you can begin to read elements of that document. The document
countrylist.xml contains, in part, this structure:
To refer to data, we refer to a nested series of arrays. The element
containing the data "Japan" would be referred to like this:
JapanNode = xmlDocHolder.childNodes[0].childNodes[1].childNodes[0]
That is, we want to refer to the first (0) element (officialName) of
the second (1) element (country) of the first (0) element
(countryList). The word "Japan" itself -- the data -- would be
referenced as:
JapanText = xmlDocHolder.childNodes[0].childNodes[1].childNodes[0].text
» posted by ITworld staff
ITworld
Sign up for ITworld's Daily newsletter
Follow ITworld on Twitter @IT_world
jfruh
Apple syncing patent can't come soon enough
pasmith
New Twitter features borrow from 3rd party clients
Esther Schindler
Open Source Changes the Software Acquisition Process
mikelgan
How to set up continuous podcast play on the new iTunes
David Strom
Five important Windows 7 mobility features
sjvn
Guard your Wi-Fi for your own sake
Sandra Henry-Stocker
Grepping on Whole Words
Sidekick: The Good News & the Bad News
Either way you look at it Microsoft Data Center management did not follow standards or best practices in this failure. In which case it makes me wonder more about the outsourcing of corporate data much less personal data.
- mburton325
Join the conversation here
Quick, practical advice for IT pros. Made fresh daily.
Want to cash in on your IT savvy? Send your tip to tips@itworld.com. If we post it, we'll send you a $25 Amazon e-gift card.













