Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

nested xml

Status
Not open for further replies.

vasah20

Programmer
Feb 16, 2001
559
0
0
US
hi all,

I've got a very very slight grasp of the javax.xml.* and org.w3c.dom.* libraries, and from some tutorials and books I've been able to parse simple xml documents.

But I need to parse a complex xml document, and I have no idea how to go about it. The document looks like this:
Code:
<?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?>
<!DOCTYPE user SYSTEM &quot;XMLStore.dtd&quot; >
<user>
  <userid>1</userid>
  <name>leo</name>
  <email>myemailaddress@domain.com</email>
  <lang>en</lang>
  <site>
    <id>1</id>
    <title>Site Number 1</title>
    <feed>[URL unfurl="true"]http://sitenumberone.org/xml/rss.xml</feed>[/URL]
    <type>rss</type>
    <freshness>1053461676414</freshness>
    <refresh>3600</refresh>
  </site>
  <site>
    <id>2</id>
    <title>site 2</title>
    <feed>[URL unfurl="true"]http://site2.org/slashdot.rdf</feed>[/URL]
    <type>rdf</type>
    <freshness>1053461676414</freshness>
    <refresh>3600</refresh>
  </site>
</user>

And I have no idea how to go about getting the individual &quot;site&quot; nodes. Suggestions would be greatly appreciated, code samples always welcome :)

TIA
leo
 
If it's always going to be a small file, you can use the DOM API to get the individual site nodes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top