Search the web
Sign In
New User? Sign Up
1stJavaScript · This is a group where questions, suggestions, etc can be posted about HTML, JavaScript and CSS, etc.
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Access XML Element   Message List  
Reply | Forward Message #2953 of 2988 |
RE: [1stJavaScript] Access XML Element

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






Mon Jul 6, 2009 9:04 am

ratkinsonuk
Offline Offline
Send Email Send Email

Forward
Message #2953 of 2988 |
Expand Messages Author Sort by Date

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...
learningyui
Offline Send Email
Jul 5, 2009
10:38 am

This page should have all that you require :- http://www.codetoad.com/xml_javascripti_tutorial.asp Command is probably childNodes[0].nodeValue,...
Atkinson, Robert
ratkinsonuk
Offline Send Email
Jul 6, 2009
9:09 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help