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:
2382
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

muiredised
ESSE QUAM VIDERI

join:2007-06-11
Tacoma, WA

reply to Entelligence
Re: Javascript - parse xml string

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.



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

reply to Entelligence
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


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


1 edit
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.
Forums » Tech and Talk » OS and Software » Webmasters and Developersattachment post to email »
« Saving values on a web server...  


Tuesday, 24-Nov 14:00:06 Terms of Use | Privacy Policy | Hosting by www.nac.net - DSL,Hosting & Co-lo | feedback | contact
over 10 years online! © 1999-2009 dslreports.com.
page compression OFF
Most commented news this week
· [96] New AT&T Ad Campaign Hits Back At Verizon
· [79] New Bill Takes Aim At Higher Verizon ETFs
· [30] Earthlink Suffers From Major E-mail Outage
· [30] AT&T Offers New Prepaid Wireless plans
· [28] Frontier Increases Modem Rental Fee
· [17] Senators Want ACTA Made Public
· [16] Vivendi In Way Of Comcast's NBC Desires
· [15] Charter Still Fighting With Creditors
· [15] In-Flight Internet Headed For Bumpy Landing?
· [11] Time Warner Dallas Customers Get WiMax December 1
Most people now reading
· Windows 7 boot manager editing questions [Microsoft Help]
· hawaii in thanksgiving [General Questions]
· What to use while demonoid is down? [Filesharing Software]
· Big Bank Alternative to Bank of America? [General Questions]
· Climate Change Scandal Erupts After Email Hack. [Security]
· Here's a chart comparing the top VoIP providers. Comments? [VOIP Tech Chat]
· 3.x Feral Druid - Bear Tanking Guide [World of Warcraft]
· Gizmo5 has added a Google Voice section in its members area. [VOIP Tech Chat]
· Bell's Network Management practices page [TekSavvy]
· Using DIR-615 C1/3.01 with Trendnet TEW-652BRP in N Mode [D-Link]