Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Best XML parsing solution?

3:09 am on Dec 7, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:Sept 4, 2002
votes: 0

I've been using AJAX for a while, but I've managed until now to get around the "X" . I've just passed back what I needed from the server and used it as-is.

I'm wondering what the best way people have found to parse returned XML is? Do you use a library, and if so, which? Or is there a straightforward way of creating and parse XML from the responseText that I'm just missing?

Thanks very much!

5:36 am on Dec 7, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 3, 2005
votes: 0

Short answer is responseXml, following handles various browser quirks

if ( typeof xh.responseXml === 'undefined' ) {
// for mozzila, should not be required, Content-Type text/xml
var parser = new DOMParser();
var doc = parser.parseFromString( xh.responseText, "text/xml" );
var XMLDoc = doc.documentElement;
else {
if ( ( xh.responseXml )
&& ( xh.responseXml.documentElement === null )
&& ( xh.responseStream) ) {
xh.responseXml.load( xh.responseStream );
var XMLDoc = xh.responseXml.documentElement;


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members