您现在的位置是:首页 > 电脑技术查询 > web开发

没有分了,但是还是要问个javascript解析xml的有关问题

编辑:chaxungu时间:2022-10-02 23:18:13分类:web开发

没有分了,但是还是要问个javascript解析xml的问题
xml数据就存放在 test.html内
如何把itmes的数据逐条读出来

数据:
<html>
<head>
<title> test.html </title>
</head>
<body>
<!---
xml 数据 开始
-->
<items>

<item>
<title> title1 </title
<body> body1 </body>
</item>

<item>
<title> title2 </title
<body> body2 </body>
</item>

<item>
<title> title3 </title
<body> body3 </body>
</item>


</items>

<!---
xml 数据 结束
-->
</body>
</html>



------解决方案--------------------
方法参考
http://msdn2.microsoft.com/en-us/library/ms535918.aspx
------解决方案--------------------
getElementsByTagName( "items ")[0].getElementsByTagName( "item ");