Submitted by: Markku Saarela git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274698 13f79535-47bb-0310-9956-ffa450edef68master
@@ -172,6 +172,8 @@ Fixed bugs: | |||||
* <fixcrlf> will now create the parent directories for the destination | * <fixcrlf> will now create the parent directories for the destination | ||||
files if necessary. Bugzilla Report 20840. | files if necessary. Bugzilla Report 20840. | ||||
* <xmlproperty> now handles CDATA sections. BugZilla Report 17195 | |||||
Other changes: | Other changes: | ||||
-------------- | -------------- | ||||
* Six new Clearcase tasks added. | * Six new Clearcase tasks added. | ||||
@@ -434,6 +436,9 @@ Other changes: | |||||
* <mapper> has an "unpackage" mapper | * <mapper> has an "unpackage" mapper | ||||
Bugzilla Report 18908 | Bugzilla Report 18908 | ||||
* Added <scriptdef> task allowing tasks to be defined using any BSF-supported | |||||
scripting language. | |||||
Changes from Ant 1.5.2 to Ant 1.5.3 | Changes from Ant 1.5.2 to Ant 1.5.3 | ||||
=================================== | =================================== | ||||
@@ -1,4 +1,5 @@ | |||||
<root-tag myattr="true"> | <root-tag myattr="true"> | ||||
<inner-tag someattr="val">Text</inner-tag> | <inner-tag someattr="val">Text</inner-tag> | ||||
<a2><a3><a4>false</a4></a3></a2> | <a2><a3><a4>false</a4></a3></a2> | ||||
<cdatatag><![CDATA[<test>]]></cdatatag> | |||||
</root-tag> | </root-tag> |
@@ -450,14 +450,25 @@ public class XmlProperty extends org.apache.tools.ant.Task { | |||||
} | } | ||||
} | } | ||||
String nodeText = null; | |||||
if (node.getNodeType() == Node.TEXT_NODE) { | if (node.getNodeType() == Node.TEXT_NODE) { | ||||
// For the text node, add a property. | |||||
nodeText = getAttributeValue(node); | |||||
} else if ((node.getNodeType() == Node.ELEMENT_NODE) | |||||
&& (node.getChildNodes().getLength() == 1) | |||||
&& (node.getFirstChild().getNodeType() == Node.CDATA_SECTION_NODE)) { | |||||
nodeText = node.getFirstChild().getNodeValue(); | |||||
} | |||||
if (nodeText != null) { | |||||
// If the containing object was a String, then use it as the ID. | // If the containing object was a String, then use it as the ID. | ||||
if (semanticAttributes && id == null | if (semanticAttributes && id == null | ||||
&& container instanceof String) { | && container instanceof String) { | ||||
id = (String) container; | id = (String) container; | ||||
System.out.println("Setting id = " + id); | |||||
} | } | ||||
// For the text node, add a property. | |||||
String nodeText = getAttributeValue(node); | |||||
if (nodeText.trim().length() != 0) { | if (nodeText.trim().length() != 0) { | ||||
addProperty(prefix, nodeText, id); | addProperty(prefix, nodeText, id); | ||||
} | } | ||||
@@ -90,6 +90,8 @@ public class XmlPropertyTest extends BuildFileTest { | |||||
assertEquals("val", | assertEquals("val", | ||||
getProject().getProperty("root-tag.inner-tag(someattr)")); | getProject().getProperty("root-tag.inner-tag(someattr)")); | ||||
assertEquals("false", getProject().getProperty("root-tag.a2.a3.a4")); | assertEquals("false", getProject().getProperty("root-tag.a2.a3.a4")); | ||||
assertEquals("CDATA failed", | |||||
"<test>", getProject().getProperty("root-tag.cdatatag")); | |||||
} | } | ||||
public void testNone () { | public void testNone () { | ||||