How to get rid of double escaping (`&`) when use Maven filters for xml files?



I use Maven 3 filters to fulfil place holders in xml files. But this requires that the inserted value is (already) xml escaped. What I want is: that Maven take care of escaping the value while putting it in the xml file.


What I have so fare:


Excerpt from the filtered xml file:



<Resource name="jdbc/dbConnection"
url="${it.testDb.jdbc}"
...
/>


The Propery from the Maven pom:



<it.testDb.jdbc>
jdbc:mysql://localhost:3306/testdb?useUnicode=true&amp;amp;characterEncoding=utf8
</it.testDb.jdbc>


You noticed that I have to use &amp;amp;. and this is what I want to get rid of, instead I want to write only &amp; (the first &amp; is because Maven load the parameter from an XML file (pom.xml), thats ok, but the second amp; only needed because Maven does not escape the string while writing, and this is what I want to get rid of.)


So is there a way that Maven escape the the value to xml-style when it puts the parameter in the file while filtering?


No comments:

Post a Comment