【发布时间】:2011-12-28 16:20:03
【问题描述】:
使用 OmniXML 和 Delphi,我想定位一个元素并更改节点中的另一个元素。例如,在下面的 xml 清单中,我想找到 /first-name = 'Joe1',然后找到 /price 并将其从 1200 更改为 10。 我尝试使用 XPathSelect,但似乎无法指定 /first-name。
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="myfile.xsl" ?>
<bookstore specialty="novel">
<book style="autobiography">
<author>
<first-name>Joe1</first-name>
<last-name>Bob</last-name>
<award>Trenton Literary Review Honorable Mention</award>
</author>
<price>1200</price>
</book>
<book style="textbook">
<author>
<first-name>Mary</first-name>
<last-name>Bob</last-name>
<publication>Selected Short Stories of
<first-name>Mary</first-name>
<last-name>Bob</last-name>
</publication>
</author>
<editor>
<first-name>Britney</first-name>
<last-name>Bob</last-name>
</editor>
<price>55</price>
</book>
</bookstore>
【问题讨论】:
-
嗨,欢迎来到 StackOverflow!这看起来是个好问题,但您的最后一句话基本上等同于“我的 XPathSelect 代码不起作用”。这不是很有帮助。您能否发布不起作用的 XPathSelect 代码并解释它做错了什么?这将使帮助您找到修复它的方法变得更加容易。谢谢。