[thelist] Problems traversing XML tree in JavaScript
marcus
m-lists at bristav.se
Tue Aug 2 07:24:34 CDT 2005
responseXML.documentElement is the root element of the document. What is
happening is perfectly correct. I don't see the problem.
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
>
>
>
More information about the thelist
mailing list