js读取xml

yaoleshi 2008-08-25 03:32:10

<?xml version="1.0" encoding="utf-8"?>
<root>
<submap id="4">
<link>
<linkdevice id="ld0">
<startdevname>Dev-172.18.192.21</startdevname>
<enddevname>Dev-172.18.192.231</enddevname>
<left1>-28</left1>
<top1>100</top1>
<left2>209</left2>
<top2>10</top2>
</linkdevice>
<linkdevice id="ld4">
<startdevname>Dev-172.18.192.245</startdevname>
<enddevname>Dev-172.18.192.238</enddevname>
<left1>510</left1>
<top1>110</top1>
<left2>510</left2>
<top2>10</top2>
</linkdevice>
<linkdevice id="ld5">
<startdevname>Dev-172.18.192.249</startdevname>
<enddevname>Dev-172.18.192.240</enddevname>
<left1>184</left1>
<top1>290</top1>
<left2>98</left2>
<top2>222</top2>
</linkdevice>
<linkdevice id="ld6">
<startdevname>Dev-172.18.192.21</startdevname>
<enddevname>Net_172.18.192.21</enddevname>
<left1>-28</left1>
<top1>100</top1>
<left2>-108</left2>
<top2>167</top2>
</linkdevice>
<linkdevice id="ld7">
<startdevname>Dev-172.18.192.231</startdevname>
<enddevname>Net_172.18.192.231</enddevname>
<left1>209</left1>
<top1>10</top1>
<left2>-39</left2>
<top2>-78</top2>
</linkdevice>
<linkdevice id="ld8">
<startdevname>Dev-172.18.192.232</startdevname>
<enddevname>Net_172.18.192.232</enddevname>
<left1>310</left1>
<top1>10</top1>
<left2>224</left2>
<top2>-154</top2>
</linkdevice>
<linkdevice id="ld9">
<startdevname>Dev-172.18.192.242</startdevname>
<enddevname>Net_172.18.192.242</enddevname>
<left1>310</left1>
<top1>110</top1>
<left2>410</left2>
<top2>210</top2>
</linkdevice>
<linkdevice id="ld10">
<startdevname>Dev-172.18.192.244</startdevname>
<enddevname>Net_172.18.192.244</enddevname>
<left1>410</left1>
<top1>110</top1>
<left2>510</left2>
<top2>210</top2>
</linkdevice>
<linkdevice id="ld11">
<startdevname>Dev-172.18.192.245</startdevname>
<enddevname>Net_172.18.192.245</enddevname>
<left1>510</left1>
<top1>110</top1>
<left2>610</left2>
<top2>210</top2>
</linkdevice>
<linkdevice id="ld12">
<startdevname>Dev-172.18.192.249</startdevname>
<enddevname>Net_172.18.192.249</enddevname>
<left1>184</left1>
<top1>290</top1>
<left2>312</left2>
<top2>373</top2>
</linkdevice>
</link>
<device id="d0">
<name>Dev-172.18.192.21</name>
<div id="plane0">
<img id="img0">
<left>-28</left>
<top>100</top>
<width>80</width>
<height>80</height>
</img>
</div>
</device>
<device id="d1">
<name>Dev-172.18.192.230</name>
<div id="plane1">
<img id="img1">
<left>110</left>
<top>10</top>
<width>80</width>
<height>80</height>
</img>
</div>
</device>
<device id="d2">
<name>Dev-172.18.192.231</name>
<div id="plane2">
<img id="img2">
<left>209</left>
<top>10</top>
<width>80</width>
<height>80</height>
</img>
</div>
</device>
<device id="d3">
<name>Dev-172.18.192.232</name>
<div id="plane3">
<img id="img3">
<left>310</left>
<top>10</top>
<width>80</width>
<height>80</height>
</img>
</div>
</device>
<device id="d4">
<name>Dev-172.18.192.236</name>
<div id="plane4">
<img id="img4">
<left>410</left>
<top>10</top>
<width>80</width>
<height>80</height>
</img>
</div>
</device>
<device id="d5">
<name>Dev-172.18.192.238</name>
<div id="plane5">
<img id="img5">
<left>510</left>
<top>10</top>
<width>80</width>
<height>80</height>
</img>
</div>
</device>
<device id="d6">
<name>Dev-172.18.192.239</name>
<div id="plane6">
<img id="img6">
<left>495</left>
<top>-119</top>
<width>80</width>
<height>80</height>
</img>
</div>
</device>
<device id="d7">
<name>Dev-172.18.192.240</name>
<div id="plane7">
<img id="img7">
<left>98</left>
<top>222</top>
<width>80</width>
<height>80</height>
</img>
</div>
</device>
<device id="d8">
<name>Dev-172.18.192.241</name>
<div id="plane8">
<img id="img8">
<left>133</left>
<top>385</top>
<width>80</width>
<height>80</height>
</img>
</div>
</device>
<device id="d9">
<name>Dev-172.18.192.242</name>
<div id="plane9">
<img id="img9">
<left>310</left>
<top>110</top>
<width>80</width>
<height>80</height>
</img>
</div>
</device>
<device id="d10">
<name>Dev-172.18.192.244</name>
<div id="plane10">
<img id="img10">
<left>410</left>
<top>110</top>
<width>80</width>
<height>80</height>
</img>
</div>
</device>
<device id="d14">
<name>Dev-172.18.192.254</name>
<div id="plane14">
<img id="img14">
<left>19</left>
<top>309</top>
<width>80</width>
<height>80</height>
</img>
</div>
</device>
<device id="d15">
<name>Net_172.18.192.21</name>
<div id="plane15">
<img id="img15">
<left>-108</left>
<top>167</top>
<width>80</width>
<height>80</height>
</img>
</div>
</device>
<device id="d16">
<name>Net_172.18.192.231</name>
<div id="plane16">
<img id="img16">
<left>-39</left>
<top>-78</top>
<width>80</width>
<height>80</height>
</img>
</div>
</device>
<device id="d17">
<name>Net_172.18.192.232</name>
<div id="plane17">
<img id="img17">
<left>224</left>
<top>-154</top>
<width>80</width>
<height>80</height>
</img>
</div>
</device>
<device id="d19">
<name>Net_172.18.192.244</name>
<div id="plane19">
<img id="img19">
<left>510</left>
<top>210</top>
<width>80</width>
<height>80</height>
</img>
</div>
</device>
<device id="d20">
<name>Net_172.18.192.245</name>
<div id="plane20">
<img id="img20">
<left>610</left>
<top>210</top>
<width>80</width>
<height>80</height>
</img>
</div>
</device>
</submap>
</root>


var divid="plan1"
var nodes=oXmlDom.documentElement.getElementsByTagName(”//root/submap/device/div[@id='"+divid+"']“);

这样获值有什么错误吗?

为什么 我用js不能得到div下面的节点值?
...全文
64 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
yaoleshi 2008-08-25
  • 打赏
  • 举报
回复
高手们有现实的例子吗 或者 比较闲的朋友 帮我写一个
wszhoho 2008-08-25
  • 打赏
  • 举报
回复
mark
西安风影 2008-08-25
  • 打赏
  • 举报
回复
var nodes=oXmlDom.documentElement.getElementsByTagName("//div[@id='"+divid+"']");
yaoleshi 2008-08-25
  • 打赏
  • 举报
回复
没人知道吗? 沙发自己做。求各位帮帮忙 郁闷了好几天了.

62,025

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧