Deconstructing XML
You can deconstruct XML files using the appropriate Inspectors. For this example, assume you have an XML file named "c:\sample.xml" that looks like this:
<?xml version="1.0"?>
<message>
<to>jim@rocket_science.com
<name>Jim Neutron</name>
<nickname>Jimmy the Geek</nickname>
</to>
<to>bob@rocket_science.com
<name>Bob Goddard</name>
<nickname>The Bobster</nickname>
</to>
<from>joe@big_sky.com</from>
<subject>Let’s do launch!</subject>
<text>We are ready to test the new orbiter!</text>
</message>
Here are the results of using various XML Inspectors on this file:
Q: node names of child nodes of xml document of file "c:\sample.xml"
A: xml
A: message
Q: node names of child nodes of selects "message" of xml document of file
"c:\sample.xml"
A: to
A: to
A: from
A: subject
A: text
Q: node names of child nodes of selects "message/to" of xml document of file
"c:\sample.xml"
A: #text
A: name
A: nickname
A: #text
A: name
A: nickname
Q: unique values of node names of child nodes of selects "message/to" of
xml document of file "c:\sample.xml"
A: #text
A: name
A: nickname
Q: node values of child nodes 0 of selects "message/to" of xml document
of file "c:\sample.xml"
A: jim@rocket_science.com%0a
Q: node values of child nodes of selects "message/to/nickname" of
xml document of file "c:\sample.xml"
A: Jimmy the Geek
A: The Bobster
Q: node names of next siblings of selects "message/to" of xml document
of file "c:\sample.xml"
A: to
A: from
Q: node names of parent nodes of selects "message/to" of xml document
of file "c:\sample.xml"
A: message
A: message