获取元素节点的节点名称和类型/查看元素的节点类型

  1. <html>
  2. <head>
  3. <script type="text/javascript" src="/example/xdom/loadxmldoc.js"></script>
  4. </head>
  5. <body>
  6.  
  7. <script type="text/javascript">
  8. xmlDoc=loadXMLDoc("/example/xdom/books.xml");
  9.  
  10. document.write(xmlDoc.documentElement.nodeName);
  11. document.write("<br />");
  12. document.write(xmlDoc.documentElement.nodeType);
  13. </script>
  14. </body>
  15. </html>