[thelist] Problems traversing XML tree in JavaScript
VOLKAN ÖZÇELİK
volkan.ozcelik at gmail.com
Tue Aug 2 07:31:43 CDT 2005
> responseXML.documentElement is the root element of the document. What is
> happening is perfectly correct. I don't see the problem.
>
if so, something like this will sort out the issue.
<documentroot>
<sites>
<site id="10">Site name 1</site>
<site id="11">Site name 2</site>
[several more lines like the above]
</sites>
...
</documentroot>
Cheers,
Volkan.
> What do you want to do that you apparantly can't when operating directly
> on the documentElement?
>
> /Marcus
>
> Paul Waring wrote:
>
> >I've currently got a relatively simple XML file that is structured like
> >so:
> >
> ><?xml version="1.0" ?>
> ><sites>
> > <site id="10">Site name 1</site>
> > <site id="11">Site name 2</site>
> > [several more lines like the above]
> ></sites>
> >
> >I've managed to get JavaScript to read in the whole file, using some
> >code that I found on Site Point, and I'm getting the document using:
> >
> >response = req.responseXML.documentElement;
> >
> >Have I done something obviously wrong? It seems to me like response is
> >already pointing to what I would expect sites[0] to be, but I want it to
> >instead hold the root of the XML document otherwise when I add extra
> >stuff later I won't be able to traverse it properly. I honestly don't
> >understand why this isn't working as I've just taken the majority of the
> >code from an article[1] and simply changed the names to reflect my
> >document structure.
> >
> >Thanks in advance,
> >
> >Paul
> >
> >[1] http://www.sitepoint.com/print/xml-javascript-mozilla
> >
> >
> >
>
>
> --
>
> * * Please support the community that supports you. * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>
More information about the thelist
mailing list