 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.
|