案例:XML DOM案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<head>
3
<script type="text/javascript" src="/example/xdom/loadxmldoc.js"> 
4
</script>
5
</head>
6
<body>
7
<script type="text/javascript">
8
9
xmlDoc=loadXMLDoc("/example/xdom/books_ns.xml");
10
var x=xmlDoc.getElementsByTagName('title');
11
12
for(i=0;i<x.length;i++)
13
{
14
document.write("Prefix: " + x.item(i).prefix);
15
document.write("<br />");
16
document.write("Local name: " + x.item(i).localName);
17
document.write("<br />");
18
document.write("Namespace URI: " + x.item(i).namespaceURI);  
19
document.write("<br />");
20
document.write("Base URI: " + x.item(i).baseURI);  
21
document.write("<br />");
22
document.write("<br />");
23
}
24
  
25
</script>
26
</body>
27
</html>
28