https://issues.apache.org/bugzilla/show_bug.cgi?id=47155
Summary: Problem with less and greater tags and replace task
Product: Ant
Version: 1.7.1
Platform: All
OS/Version: Windows XP
Status: NEW
Severity: major
Priority: P2
Component: Core tasks
AssignedTo: [email protected]
ReportedBy: [email protected]
I'm trying to use ant to replace some values in XML file.
So I need to specify tags >, < in replacetoken.
It's behavior not good.
1. Code
<replace dir="${my.dir}">
<replacetoken><![CDATA[<name>Name</name>]]></replacetoken>
<replacevalue><![CDATA[<name>${name}</name>]]></replacevalue>
<include name="${what}.xml"/>
</replace>
Produces this in xml:
<name>${name}</name>
Instead of real property value;
2. Code
<replace dir="${my.dir}" >
<replacetoken><name>Name</name></replacetoken>
<replacevalue><name>${name}</name></replacevalue>
<include name="${what}.xml"/>
</replace>
Produces the same in xml:
<name>${name}</name>
Instead of real property value;
3. A little trick here, make invalid token and replace value like this:
<replace dir="${hn.dir}" >
<replacetoken><name>Name</name>></replacetoken>
<replacevalue><name>${name}</name>></replacevalue>
<include name="${what}.xml"/>
</replace>
Produces the wanted result:
<name>Replaced here with property Value</name>
If you didn't see the difference - it's additional ">" before closing tags
replacetoken and replacevalue.
I see here two bugs:
1. The correct (well-formed) token didn't parsed for properties if there are
tags (and in XML files thea are)
2. The incorrect token, which isn't in file however parsed (!) for properties,
then trailing symbols are dropped, and all replaced as needed.
That's not very well behaviour, I had to find this bug to replace something in
XML files :)
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.