更新时间:2023-11-13 23:25:04
以下示例任务将替换<beers type="B">
的beerPrice
到300
。
您可以使用循环、变量等和其他特定的XPath表达式来扩展此示例。
- xml:
path: file1.xml
xpath: /business/beers[@type='B']/beerPrice
value: '300'
state: present
更新
下面的示例将<beers type="B">
的type
属性修改为<beers type="XL">
。
- xml:
path: file1.xml
xpath: /business/beers[@type='B']
value: XL
attribute: type
state: present