jQuery.parseXML( data )
Returns: XMLDocument
Description: Parses a string into an XML document.
Arguments
jQuery.parseXML( data )
version added: 1.5
data
XML string
a well-formed XML string to be parsed.
jQuery.parseXML uses the native parsing function of the browser to create a valid XML Document. This document can then be passed to jQuery to create a typical jQuery object that can be traversed and manipulated.Example
Create a jQuery object using an XML string and obtain the value of the title node.
var xml = '<rss version="2.0"><channel><title>RSS Title</title></channel></rss>',
xmlDoc = $.parseXML( xml ),
$xml = $( xmlDoc ),
$title = $xml.find( 'title' );
// append "RSS Title" to #someElement
$( '#someElement' ).append( $title.text() );
// change the title to "XML Title"
$title.text( 'XML Title' );
// append "XML Title" to #anotherElement
$( '#anotherElement' ).append( $title.text() );
Was this information helpful?

