diff --git a/docs/manual/CoreTasks/macrodef.html b/docs/manual/CoreTasks/macrodef.html index 7d7fa7e40..0214af24a 100644 --- a/docs/manual/CoreTasks/macrodef.html +++ b/docs/manual/CoreTasks/macrodef.html @@ -38,17 +38,6 @@ No - - attributestyle - - Temporary - this attribute specifies if the attribute is in ant style - (i.e. ${attributeName}) or xpath style (i.e @attributeName). - Valid values are "ant" and "xpath". The default value - is "ant". - - No -

Parameters specified as nested elements

attribute

@@ -63,11 +52,6 @@ task using the ant property notation - ${attribute name}. Note that is not an actual ant property.

-

- If the attribute style is set to "xpath", the attribute is - specified in the body of the template task by prefixing the - name with a "@". -

Parameters

@@ -140,23 +124,6 @@ </testing> -

- The following fragment sets the attribute style to "xpath" - for the macro definition <testing> and calls the - macro. The fragment should output "attribute is this is a test". -

-
-
-<macrodef name="testing" attributestyle="xpath">
-   <attribute name="abc"/>
-   <sequential>
-      <echo>attribute is @abc</echo>
-   </sequential>
-</macrodef>
-
-<testing abc="this is a test"/>
-      
-

The following fragment defines a task called <call-cc> which take the attributes "target", "link" and "target.dir" and the diff --git a/src/etc/testcases/taskdefs/macrodef.xml b/src/etc/testcases/taskdefs/macrodef.xml index 8a67d47ac..4669a6c5f 100644 --- a/src/etc/testcases/taskdefs/macrodef.xml +++ b/src/etc/testcases/taskdefs/macrodef.xml @@ -45,14 +45,4 @@ - - - - - attribute is @abc@abc - - - - - diff --git a/src/main/org/apache/tools/ant/taskdefs/MacroDef.java b/src/main/org/apache/tools/ant/taskdefs/MacroDef.java index 6dd19b658..09765781c 100644 --- a/src/main/org/apache/tools/ant/taskdefs/MacroDef.java +++ b/src/main/org/apache/tools/ant/taskdefs/MacroDef.java @@ -81,7 +81,6 @@ public class MacroDef extends AntlibDefinition implements TaskContainer { private String name; private List attributes = new ArrayList(); private Map elements = new HashMap(); - private int attributeStyle = AttributeStyle.ANT; /** * Name of the definition @@ -91,46 +90,6 @@ public class MacroDef extends AntlibDefinition implements TaskContainer { this.name = name; } - /** - * Enumerated type for attributeStyle attribute - * - * @see EnumeratedAttribute - */ - public static class AttributeStyle extends EnumeratedAttribute { - /** Enumerated values */ - public static final int ANT = 0, XPATH = 1; - - /** - * get the values - * @return an array of the allowed values for this attribute. - */ - public String[] getValues() { - return new String[] {"ant", "xpath"}; - } - } - - /** - * Experimental - * I am uncertain at the moment how to encode attributes - * using ant style ${attribute} or xpath style @attribute. - * The first may get mixed up with ant properties and - * the second may get mixed up with xpath. - * The default at the moment is ant s - * - * @param style an AttributeStyle value - */ - public void setAttributeStyle(AttributeStyle style) { - attributeStyle = style.getIndex(); - } - - /** - * Experimental - * @return the attribute style - */ - public int getAttributeStyle() { - return attributeStyle; - } - /** * Set the class loader. * Not used @@ -435,9 +394,6 @@ public class MacroDef extends AntlibDefinition implements TaskContainer { } } - if (attributeStyle != other.attributeStyle) { - return false; - } if (!nestedTask.similar(other.nestedTask)) { return false; } diff --git a/src/main/org/apache/tools/ant/taskdefs/MacroInstance.java b/src/main/org/apache/tools/ant/taskdefs/MacroInstance.java index 326067ce3..a0484bfab 100644 --- a/src/main/org/apache/tools/ant/taskdefs/MacroInstance.java +++ b/src/main/org/apache/tools/ant/taskdefs/MacroInstance.java @@ -146,7 +146,7 @@ public class MacroInstance extends Task implements DynamicConfigurator { } } - private String macroSubsAnt(String s, Map macroMapping) { + private String macroSubs(String s, Map macroMapping) { StringBuffer ret = new StringBuffer(); StringBuffer macroName = new StringBuffer(); boolean inMacro = false; @@ -179,59 +179,6 @@ public class MacroInstance extends Task implements DynamicConfigurator { return ret.toString(); } - private String macroSubsXPath(String s, Map macroMapping) { - StringBuffer ret = new StringBuffer(); - StringBuffer macroName = new StringBuffer(); - boolean inMacro = false; - for (int i = 0; i < s.length(); ++i) { - char c = s.charAt(i); - if (!inMacro) { - if (c == '@') { - inMacro = true; - } else { - ret.append(c); - } - } else { - if (MacroDef.isValidNameCharacter(c)) { - macroName.append(c); - } else { - inMacro = false; - String name = macroName.toString(); - String value = (String) macroMapping.get(name); - if (value == null) { - ret.append("@" + name); - } else { - ret.append(value); - } - if (c == '@') { - inMacro = true; - } else { - ret.append(c); - } - macroName = new StringBuffer(); - } - } - } - if (inMacro) { - String name = macroName.toString(); - String value = (String) macroMapping.get(name); - if (value == null) { - ret.append("@" + name); - } else { - ret.append(value); - } - } - return ret.toString(); - } - - private String macroSubs(String s, Map macroMapping) { - if (macroDef.getAttributeStyle() == MacroDef.AttributeStyle.ANT) { - return macroSubsAnt(s, macroMapping); - } else { - return macroSubsXPath(s, macroMapping); - } - } - private UnknownElement copy(UnknownElement ue) { UnknownElement ret = new UnknownElement(ue.getTag()); ret.setNamespace(ue.getNamespace()); diff --git a/src/testcases/org/apache/tools/ant/taskdefs/MacroDefTest.java b/src/testcases/org/apache/tools/ant/taskdefs/MacroDefTest.java index e6b8987a2..24e40d12f 100644 --- a/src/testcases/org/apache/tools/ant/taskdefs/MacroDefTest.java +++ b/src/testcases/org/apache/tools/ant/taskdefs/MacroDefTest.java @@ -86,8 +86,5 @@ public class MacroDefTest extends BuildFileTest { expectLog("nested", "A nested element"); } - public void testXPathStyle() { - expectLog("xpathstyle", "attribute is this is a testthis is a test"); - } }