日期:2014-05-16  浏览次数:20341 次

js读取本地xml
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
                 xmlDoc.async="false";
                 xmlDoc.load("./xxx.xml")
                 $(xmlDoc).find("person").each(function(i){
                      alert($(this).attr('name'))
                 });
用到了jquery.
xml结构如下:
<?xml ...>
<persons>
    <person name='kevin'>
    </person>
</persons>