Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #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


  #2 (permalink)  
Old July 23rd, 2007, 09:17 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Can you show an example of what you mean?

--

Joe (Microsoft MVP - XML)
  #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

  #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


  #5 (permalink)  
Old July 23rd, 2007, 11:31 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 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)
  #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:)



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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.