I have an xml file where I need to comment out a whole piece of text with Ant.
There's this ant task
<replace file="${src.dir}/Version.as" token="@revisionPrana" value="${revision}"/>
that I use to replace words, but in my case I need to replace a whole block like this:
<value>
<object class="edumatic.backoffice.view.modules.NavigationModuleInfo">
<property name="url"
value="edumatic/backoffice/view/modules/support/ExamsNavigationModule.swf" />
<property name="icon"
value="edumatic/backoffice/view/modules/support/assets/book.png" />
<property name="title" value="Assessments" />
<property name="pluginID" value="EXAM" />
</object>
</value>
<value>
<object class="edumatic.backoffice.view.modules.ContentModuleInfo">
<property name="url"
value="edumatic/backoffice/view/modules/support/ExamsContentModule.swf" />
<property name="pluginID" value="EXAM" />
</object>
</value>
Into
<!--value>
<object class="edumatic.backoffice.view.modules.NavigationModuleInfo">
<property name="url"
value="edumatic/backoffice/view/modules/support/ExamsNavigationModule.swf" />
<property name="icon"
value="edumatic/backoffice/view/modules/support/assets/book.png" />
<property name="title" value="Assessments" />
<property name="pluginID" value="EXAM" />
</object>
</value>
<value>
<object class="edumatic.backoffice.view.modules.ContentModuleInfo">
<property name="url"
value="edumatic/backoffice/view/modules/support/ExamsContentModule.swf" />
<property name="pluginID" value="EXAM" />
</object>
</value-->
So, basically I need to comment out a whole block of XML. Can I do this with a replace task (putting the whole block in the attribute token and value doesn't really work)? Or is there a quick way to read in the xml with ant and delete some nodes and save the xml again?
Searching for and replace it by isn't an option because there are multiple value children and not all of them need to be commented out.
Adding a attribute like isn't an option either because the xml is being parsed by an IOC container (Prana). Maybe prana will ignore the id="1" but it still iss messy, and I don't like messy on the long term.
Thx, Lieven Cardoen aka Johlero