ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pankaj Arora01 <Pankaj_Aror...@infosys.com>
Subject Replaceregexp in ANT
Date Thu, 16 Apr 2009 08:24:56 GMT
HI all,



I have an XML file that contain the following tags:



<A>

      <UserName>UserA</UserName>

      <Password>password</Password>

      <SID>rdf12</SID>

      <Host>10.8</Host>

</A>

<B>

      <UserName>UserB</UserName>

      <Password>password</Password>

      <SID>rdf12</SID>

      <Host>10.8.</Host>

</B>





I have a property file that has following properties:

userNameA   TestA

passwordA   passwordA

userNameB   TestB

and so on...





Now I need to update the XML file with the corresponding properties. After updation output
should be something like



<A>

      <UserName>TestA</UserName>

      ......

</A>

<B>

      <UserName>TestB</UserName>

      ....

</B>



I cannot use replace <UserName>(.)*</UserName> because same tag is present in
both A and B.



I know replaceregexp should serve the purpose but I am unable to do it due to multiple lines.
I need to replace the complete set of A properties at one go...May be treating it as a single
line.



How to do this?





Thanks in advance

Pankaj



**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely 
for the use of the addressee(s). If you are not the intended recipient, please 
notify the sender by e-mail and delete the original message. Further, you are not 
to copy, disclose, or distribute this e-mail or its contents to any other person and 
any such actions are unlawful. This e-mail may contain viruses. Infosys has taken 
every reasonable precaution to minimize this risk, but is not liable for any damage 
you may sustain as a result of any virus in this e-mail. You should carry out your 
own virus checks before opening the e-mail or attachment. Infosys reserves the 
right to monitor and review the content of all messages sent to or from this e-mail 
address. Messages sent to or from this e-mail address may be stored on the 
Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message