8

Parsing XML in JavaScript?

 3 years ago
source link: http://www.mikechambers.com/blog/2006/01/09/parsing-xml-in-javascript/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Parsing XML in JavaScript?

Monday, January 9, 2006

I have been doing some work with JavaScript / Ajax lately, and found myself needing to parse some XML (something I do quite often when building apps). However, I have not had much luck successfully parsing XML with JavaScript cross browser.

Firefox 1.5 has support for E4X, which makes parsing a breeze, but it is only supported in the latest version of Firefox. The XMLHttpRequest object parses loaded XML into a DOM, but my experience has been that the DOM is different depending on the browser you are running in (I tested on Firefox and Sarafi on Mac).

I know that I must be missing something pretty obvious, but just about every article I have read online about this suggests to NOT use XML, and use something like JSON where possible (which I can’t do in this case).

So, if you are doing JavaScript development, what are you using to do cross-browser XML parsing in JavaScript on the client side?


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK