0

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.

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

2 Answers2

0

I would plug in XMLTask since this is precisely what it's designed to do! 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)

Community
  • 1
  • 1
Brian Agnew
  • 268,207
  • 37
  • 334
  • 440
0

I hope that this link help you. It´s explains how you can do this using the xmlTask.

DaveShaw
  • 52,123
  • 16
  • 112
  • 141
thiagolsilva
  • 439
  • 4
  • 11