You really didn't need to post that monsterous listing, just one item posted as code would have been sufficient. What you needed to post but didn't is exactly what your problem is? Have you worked through one of the numerous tutorials on DOM parsing such as this one? What have you tried so far? What happens when you try it? Bill
Joined: Apr 11, 2006
Right here my sample feed bit smaller and code
The result is it says there are three child elements, but there are alot more than three child elements. What's going on. Its the channel tag im thinking how do i get beyond it or set it as the root element. [ April 22, 2006: Message edited by: Paul Donaghy ]
The result is it says there are three child elements, but there are alot more than three child elements.
No, unsurprisingly the result is correct (except there are actually three child nodes). The document element is an <rss> element. And under that there are indeed three child nodes:
1. A whitespace text node containing a linefeed character. 2. A <channel> element. 3. Another whitespace text node.
That's it. I suppose your confusion would be partly cleared up if you had an indented listing of the XML document. Then it would be more apparent that the <channel> element itself has quite a few child nodes; many of them are <item> elements that in turn have their own children.
You can traverse this tree structure by writing appropriate DOM code. I won't post any DOM code here because (a) I hate writing DOM code and I would rather use XSLT whenever it's necessary to extract data from XML, and (b) William Brogden already provided a link to a tutorial with DOM code.