我有我的名为Test.xml的xml文件。我只想将xml标记<con:selectedAuthProfile>value</con:selectedAuthProfile>
的内容从值替换为xml标记<con:testStep>
中的“Pharmacy-Authorization”,其id =“123456789”。我希望我能为此找到代码。 Thankyou提前的家伙!我会解释下面的过程。替换批处理文件中的特定XML标记内容
- 搜索XML标记
<con:testStep type=a id=>
id为 “123456789” 内部的标签,我需要更换XML标签
<con:selectedAuthProfile>*</con:selectedAuthProfile>
下面的内容是代码:
<con:testStep type="a" name="TestStep 1" id="123456789"> <xml1>XMLVALUE1</xml1> <xml2>XMLVALUE2</xml2> <con:selectedAuthProfile>value</con:selectedAuthProfile> </con:testStep> <con:testStep type="b" name="TestStep 2" id="987654321"> <xml3>XMLVALUE3</xml3> <xml4>XMLVALUE4</xml4> <con:selectedAuthProfile>value</con:selectedAuthProfile> </con:testStep>
正如您在XML中看到的那样,有两个实例/标记<con:selectedAuthProfile>value</con:selectedAuthProfile>
的发生。我只想根据其标记为<con:testStep>
的“父母标记”更改此标记的内容,其ID =“123456789”。我希望这将是可能的
它会变得棘手,因为'*'被批量保留为通配符。 – Jonas
我只是把*作为示例内容。我只是编辑它:) – creulo
好吧我有一个解决方案来更改文件中的特定单词我希望它可以帮助 – Jonas