This page should have all that you require :-
http://www.codetoad.com/xml_javascripti_tutorial.asp
Command is probably childNodes[0].nodeValue, childNodes[0].nodeText or
childNodes[0].text
Rob.
-----Original Message-----
From: 1stJavaScript@yahoogroups.com [mailto:1stJavaScript@yahoogroups.com] On
Behalf Of learningyui
Sent: 04 July 2009 23:38
To: 1stJavaScript@yahoogroups.com
Subject: [1stJavaScript] Access XML Element
Hi All,
I have simple XML file which is listed below. I need to have JavaScript be
able to retrieve the value of Caption (Welcome To The Club!).
All my code is below.
Thanks!
XML:
<?xml version="1.0"?>
<root>
<Grid>
<Type>
<attr0>0 </attr0>
</Type>
<AutoResizeColumns>
<attr0>0 </attr0>
</AutoResizeColumns>
<AutoSearch>
<attr0>1 </attr0>
</AutoSearch>
<Caption>
<attr0>Welcome To The Club!</attr0>
</Caption>
</Grid>
</root>
Javascript:
I can get the WORD attr0 by having:
alert
(o.responseXML.getElementsByTagName('Caption')[0].childNodes[0].nodeName);
but I can NOT get to the value.
------------------------------------
For a quick response, your message should include,
- A copy of the code
- A copy of any error messages
- A description of what you're trying to achieve
- A description of what's actually happening
http://www.trans4mind.com/personal_development/HTMLGuide/index.html For HTML
http://www.trans4mind.com/personal_development/JavaScript/index.html For
JavaScript
You can also download the JavaScript and HTML tutorials (Nearly 2.5
megabytes.)
--------------------------
FREE zip/unzip program:
http://www.trans4mind.com/personal_development/zipper/index.html
--------------------------OR go to and change your settings:
http://groups.yahoo.com/group/1stJavaScript/
List owner: 1stJavaScript-owner@yahoogroups.com
://groups.yahoo.com/group/1stJavaScript/
List owner: 1stJavaScript-owner@yahoogroups.com
Yahoo! Groups Links