1. Read XML string:
For example:
$(document).ready(function(){
var xml = "liublchencp< ;/root>";
//var xml="
"; // You can also directly identify Table
var obj = $(xml).find("record");
});
Note: Be sure to wrap a layer of xml outside, so that jquery In order to be recognized, there also needs to be a root node in the xml, which is root or something else that can be customized.
2. Read the XML file
For example:
$(document).ready(function(){
$.get('mydata.xml',function(xml)
{
$(xml).find( "book").each(function(){
var xmlAttr=$(this).attr("Attribute");
var xmlText=$(this).fint("node").text() ;
});
});
});