Hello list,
I'm having problem parsing an XML file with JavaScript. I've
looked through all the books I have and plenty of google
searches but I keep hitting brick walls. Here's the
structure of my XML file:
<rootNode>
<mainItem>
<widgetName>Sprocket</widgetName>
<property1>Foo</property1>
<property2>Bar</property2>
</mainItem>
<mainItem>
<widgetName>Cog</widgetName>
<property1>Hello</property1>
<property2>World</property2>
</mainItem>
</rootNode>
So I can get the XML file into a variable just fine:
var doc = request.responseXML
And I can even get the <mainItem>s into a variable
too:
var items = doc.getElementsByTagName('mainItem')
But from here I'm stuck. Using firstChild, hasChildNodes(),
or anything of the like gets me stuck. Can anyone shed some
light or point me in the right direction? I'm trying to get
down into the values of the mainItem properties (e.g. output
"Sprocket", "Foo", "Bar",
etc)
Thanks
-Nick
Visit http://aiaiai.com for
more groups to join
Yahoo! Groups Links
<*> To visit your group on the web, go to:
ht
tp://groups.yahoo.com/group/JavaScript_Official/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/JavaScript_Official/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:JavaScript_Official-digest@yahoogroups.com
mailto:JavaScript_Official-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
JavaScript_Official-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.c
om/info/terms/
|