+ -
当前位置:首页 → 问答吧 → js操作xml问题

js操作xml问题

时间:2011-07-21

来源:互联网

xml文档格式如下(node.xml):
<?xml version="1.0" encoding="utf-8"?>
<node>
<item id="1" parentid="1" name="ping" />
<item id="2" parentid="1" name="nbtstat" />
<item id="3" parentid="1" name="tracert" />
</node>
js 代码如下:
loadXML = function(xmlFile){
var xmlDoc;
if(window.ActiveXObject){
xmlDoc = new ActiveXObject('Microsoft.XMLDOM');
xmlDoc.async = false;
xmlDoc.load(xmlFile);
}
else if (document.implementation&&document.implementation.createDocument){
xmlDoc = document.implementation.createDocument('', '', null);
xmlDoc.load(xmlFile);
}
else
{
return null;
}
return xmlDoc;
}
请问在PHP里该如何操作才能读取 id,parent,name的值?
还请高手指教。

作者: adong2838   发布时间: 2011-07-21

在線等待中。。。。

作者: adong2838   发布时间: 2011-07-21

热门下载

更多