Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XML
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old July 23rd, 2007, 09:14 AM
Registered User
 
Join Date: Jun 2007
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default parsing xml

i have parsed xml through javascript but i have one confusion
i dont know how to parse an instruction parent which has all the child elements in it
if some one could help me out


Reply With Quote
  #2 (permalink)  
Old July 23rd, 2007, 09:17 AM
joefawcett's Avatar
Wrox Author
Points: 9,712, Level: 42
Points: 9,712, Level: 42 Points: 9,712, Level: 42 Points: 9,712, Level: 42
Activity: 7%
Activity: 7% Activity: 7% Activity: 7%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,066
Thanks: 1
Thanked 36 Times in 35 Posts
Default

Can you show an example of what you mean?

--

Joe (Microsoft MVP - XML)
Reply With Quote
  #3 (permalink)  
Old July 23rd, 2007, 10:26 AM
Registered User
 
Join Date: Jun 2007
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi
this is the code

i have to get the attribute value and the message in it

<paramet>
    <para1 text="some definition of the parameter">/s</para1>
     <para2 text="wat it does etc....">/a</para2>
</paramet>

thanks

Reply With Quote
  #4 (permalink)  
Old July 23rd, 2007, 10:32 AM
Registered User
 
Join Date: Jun 2007
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi

Could you please tell me how do i
parse this code

<instructions>
    <p> "test" is a parent element which gives a complete description of the "test" </p>
    <p> " description" gives you the details as to what the test is and its features" </p>
</instructions>

when i tried calling the function by

document.getElementById("instructions").innerHTML= xmlDoc.getElementsByTagName("instructions")[0].childNodes[0].nodeValue;

it doesnt retrieve the message and it is because of the <p>
but if i remove that the entire syntax gets ruined
please tell me how do i do it

thanks a lot


Reply With Quote
  #5 (permalink)  
Old July 23rd, 2007, 11:31 AM
joefawcett's Avatar
Wrox Author
Points: 9,712, Level: 42
Points: 9,712, Level: 42 Points: 9,712, Level: 42 Points: 9,712, Level: 42
Activity: 7%
Activity: 7% Activity: 7% Activity: 7%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,066
Thanks: 1
Thanked 36 Times in 35 Posts
Default

I'm confused, what does the last post have to do with the one before it? If you have separate questions can you start a fresh post for each?
For the last post you need xmlDoc.getElementsByTagName("instructions")[0].childNodes[0].childNodes[0].nodeValue, for the previous one you need paramet/para1/@text and the string value of paramet/para1. Otherwise try to provide a clearer description of what you currently have and what exactly you need.


--

Joe (Microsoft MVP - XML)
Reply With Quote
  #6 (permalink)  
Old July 24th, 2007, 11:37 AM
Registered User
 
Join Date: Jun 2007
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks a lot:)

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Parsing the xml which is having vikkiefd XML 14 July 28th, 2008 05:21 AM
XML parsing denzil_cactus Perl 0 June 11th, 2007 02:34 AM
XML Parsing SCADA_Monkey XML 2 March 11th, 2007 03:20 PM
XML Parsing tgopal Javascript 2 July 27th, 2004 08:54 AM
XML Parsing tgopal .NET Web Services 1 June 15th, 2004 03:25 AM



All times are GMT -4. The time now is 05:25 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.