user3384223
user3384223

Reputation: 35

How to use XMLTask Search replace

I'm trying to search and replace using below code.

    <replaceregexp  flags="g">  
   <regexp pattern="location=&quot;(.*?)&quot;"/>
        <substitution expression="location=&quot;xsd/\1&quot;"/> 
    <fileset dir="${fmw.finalDir}/xsl" includes="*.xsl"/>
      </replaceregexp>  

It is working fine. But i want to know is there any way i can perform similar thing using "xmltask"

Upvotes: 1

Views: 1508

Answers (1)

Patrice M.
Patrice M.

Reputation: 4319

With xmltask you need to express the location to be replaced with xpath, so it really is only practical if you can do that easily.

Assuming it's the case for you, you can indeed follow the example on the XmlTask online documentation and write e.g.

<xmltask todir="${fmw.finalDir}/xsl">
   <fileset dir="${fmw.finalDir}/xsl" includes="*.xsl"/>
   <replace path="A/B/C[@location=""]/@location" withText="xsd"/>
</xmltask>

Upvotes: 1

Related Questions