republican-creole
Search:  

 
 
   All ForumsHot TopicsGallery






how-to block ads


 
Forums » Tech and Talk » OS and Software » Webmasters and Developers » Javascript - parse xml string
Search Topic:
Uniqs:
2317
Share Topic:
RSS topic:
toggle:
flat / full
normal / watch
Posting:
Post a:
Post a:
attachment post to email »
« Saving values on a web server...  
AuthorAll Replies


Entelligence
Ek Lite
Premium
join:2002-04-24
Santa Barbara, CA
clubs:


1 edit
Javascript - parse xml string

I have found a decent amount of info on google - but nothing is seeming to work for me. I'm trying to take a javascript string, and parse it into an object so that I can traverse through it. Just as any other dom object, getElementById, firstChild, etc. Can anyone provide a simple example?


I would like this to output

Thanks in advance.

--
If it were socially acceptable, I would drape myself in velvet.


theedj
Right Back At-Cha
Premium
join:2002-12-12
Calgary
clubs:

Not sure 100% your end result, but using something like jQuery along with a great tutorial I found, I was able to do all sorts of stuff with a single XML file.
--
# a b c d e f g h i j k l m n o p q r s t u v w x y

muiredised
ESSE QUAM VIDERI

join:2007-06-11
Tacoma, WA

reply to Entelligence
This is very easy in Gecko based browsers because when you insert a string with innerHTML it is parsed and added into the DOM right away, and they have a non-standard method called DOMParser(). Internet Explorer however, is much more of a challenge. For a cross browser solution I found this:

»jmvidal.cse.sc.edu/talks/javascr···ides.xml

I was able to accomplish what you desire using sections 1.1 and 1.3 from the above link. I basically copied and pasted the code from those two sections, preceded it with "var XML = {};" and was able to access the contents of your xml_string via the DOM.

Beware of the differences between the HTML DOM and the XML DOM. More info on this can be found here (this article also features the same code as the above link):

»www.webreference.com/programming···2/4.html

Hope that helps.

Forums » Tech and Talk » OS and Software » Webmasters and Developersattachment post to email »
« Saving values on a web server...  


Sunday, 08-Nov 21:18:23 Terms of Use | Privacy Policy | Hosting by www.nac.net - DSL,Hosting & Co-lo | feedback | contact
over 10 years online! © 1999-2009 dslreports.com.republican-creole
page compression OFF
Most commented news this week
· [156] Cable Uncapper Faces Criminal Charges
· [140] AT&T Sues Verizon Over 3G Ads
· [112] Why Run Fiber When You Can Run Ads That Pretend You Do?
· [108] Comcast Is Simply Getting Huge
· [93] Apple Cooking Up New $30 A Month TV Service?
· [83] Bits Of ACTA Agreement Leaking Out
· [80] Will 'Three Strikes' Come To The United States?
· [78] Verizon To Double Smartphone ETFs?
· [77] Verizon: Droid Tethering Will Cost $30 Extra
· [73] Comcast, NBC Deal Almost Complete
Most people now reading
· 3.x Feral Druid - Bear Tanking Guide [World of Warcraft]
· My cat is reluctant to exercise. [General Questions]
· Hit and run [General Questions]
· [WIN7] Which Services in Win 7 Have You Turned Off? [Microsoft Help]
· [NFL] Week 9 Games Thread [Sports Chat]
· [Rant] Brand New 'Jasper' Xbox360 - RRoD Hardware Failure [Rants, Raves, and Praise]
· Rental modem -> Purchased modem procedure [Comcast HSI]
· Connecting to Google Voice Via SIP [VOIP Tech Chat]
· [Need Info] Looking for backup software... [Software]