[英]Ant Replacing a specific occurrence in xml
I have xml like following and I want to change a specific occurrence of a value using Ant ( tried replaceregexp but didnt help much as it finds multiple occurrences , replace also replaces multiple occurrences) and we dont have xmltask integrated. 我有以下类似的xml,我想使用Ant来更改值的特定出现(尝试了replaceregexp,但由于它发现了多个出现,并没有太大帮助,replace也替换了多个出现),并且我们没有集成xmltask。
<databases>
<database>
<server>mssql_1</server>
<port>1433</port>
<sid_instance>foobar</sid_instance>
<path></path>
<hostuser>sa</hostuser>
<hostpwd>password</hostpwd>
</database>
<database>
<server>oracle_1</server>
<port>1521</port>
<sid_instance>foobar</sid_instance>
<path>C:\\oracle\\oradata\\foobar</path>
<hostuser>system</hostuser>
<hostpwd>password</hostpwd>
</database>
</databases>
I would plug in XMLTask since this is precisely what it's designed to do! 我将插入XMLTask,因为这正是它的设计目的! Can't you just load it into (say) your home dir and provide a classpath reference as per this SO answer ?
您能否仅将其加载到(例如)您的主目录中,并按照此答案提供类路径引用?
(speaking as the author of XMLTask) (以XMLTask的作者的身份发言)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.