js解析XML
//在当前页面内追加换行标签和指定的HTML内容
function w( html ){
$(document.body).append("<br/>" + html);
}
var xmlStr = '<?xml version="1.0" encoding="UTF-8"?>';
xmlStr += '<user>';
xmlStr += '<username>CodePlayer</username>';
xmlStr += '<age>33</age>';
xmlStr += '</user>';
var xmlDoc = $.parseXML( xmlStr );
$xml = $( xmlDoc );
var username = $xml.find("username").text();
w( username ); // CodePlayer
var $age = $xml.find("age");
w( $age.text() ); // 18
$age.text("20");
w( $age.text() ); // 20