Reputation: 190
I am having the following xml,
<?xml version="1.0" encoding="UTF-8"?>
<power-domains>
<power-domain name="Security" cache-type="default">
<authentication>
<login-module code="test.module" flag="required" module="com.test.ems">
<module-option name="principal" value="admin"/>
<module-option name="userName" value="admin"/>
<module-option name="password" value=""/>
</login-module>
</authentication>
</power-domain>
</power-domains>
I would like to replace the following line using ant?
<module-option name="userName" value="admin"/>
Could you please guide me how to do it?
Upvotes: 0
Views: 122
Reputation: 163282
Use the XSLT task in Ant to modify the document. If you use XSLT 3.0 then it's
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0">
<xsl:mode on-no-match="shallow-copy">
<xsl:template match="module-option[@name='userName']">
<replacement goes="here"/>
</xsl:template>
</xsl:transform>
Upvotes: 2