解决方案 »

  1.   


    <script type="text/javascript">
    function loadXMLDoc(dname)
    {
    if (window.XMLHttpRequest)
      {
      xhttp=new XMLHttpRequest();
      }
    else
      {
      xhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xhttp.open("GET",dname,false);
    xhttp.send("");
    return xhttp.responseXML;
    }xml=loadXMLDoc("...xml");
    path="//application [@name='Fetion']"
    // code for IE
    if (window.ActiveXObject)
    {
    var nodes=xml.selectNodes(path);for (i=0;i<nodes.length;i++)
      {
      document.write(nodes[i].nodeValue);
      }
    }
    else if (document.implementation && document.implementation.createDocument)
    {
    var nodes=xml.evaluate(path, xml, null, XPathResult.ANY_TYPE,null);
    var result=nodes.iterateNext();while (result)
      {
      document.write(result.nodeValue + "<br />");
      result=nodes.iterateNext();
      }
    }
    </script>
      

  2.   

    jdom  xpath 都可以遍历 节点获取。