2

OmniXML と Delphi を使用して、要素を検索し、ノード内の別の要素を変更したいと考えています。たとえば、以下の xml リストで、/first-name = 'Joe1' を見つけて、/price を 1200 から 10 に変更したいと思います。XPathSelect を使用してみましたが、/ を指定できないようです。ファーストネーム。

<?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>
4

1 に答える 1

2

//book[author/first-name = "Joe1" ]クエリとして使用しXPathSelectてノードを取得し、そのノードからサブノードにアクセスしPriceて変更します。

于 2011-12-28T17:52:23.517 に答える