From e5eca124f469c0e89654f0fd210347f674995290 Mon Sep 17 00:00:00 2001
From: Peter Reilly Almost always in Ant 1.6, elements nested inside a namespaced
+
+ Almost always in Ant 1.6, elements nested inside a namespaced
element have the same namespace as their parent. So if 'task' in the
example above allowed a nested 'config' element, the build file snippet
would look like this:
@@ -110,6 +111,18 @@
...
</task>
+
+ From Ant 1.6.2, elements nested inside a namespaced element may also be
+ in Ant's default namespace. This means that the following is now allowed:
+ Namespaces and Nested Elements
-
<typedef resource="org/example/tasks.properties" + uri="http://example.org/tasks"/> + <my:task xmlns:my="http://example.org/tasks"> + <config a="foo" b="bar"/> + ... + </my:task> ++
diff --git a/src/main/org/apache/tools/ant/IntrospectionHelper.java b/src/main/org/apache/tools/ant/IntrospectionHelper.java index aa50722a8..9c38d98d2 100644 --- a/src/main/org/apache/tools/ant/IntrospectionHelper.java +++ b/src/main/org/apache/tools/ant/IntrospectionHelper.java @@ -604,7 +604,7 @@ public final class IntrospectionHelper implements BuildListener { parentUri = ""; } NestedCreator nc = null; - if (uri.equals(parentUri)) { // || uri.equals("")) { + if (uri.equals(parentUri) || uri.equals("")) { nc = (NestedCreator) nestedCreators.get( name.toLowerCase(Locale.US)); } @@ -775,7 +775,7 @@ public final class IntrospectionHelper implements BuildListener { return ( nestedCreators.containsKey(name.toLowerCase(Locale.US)) - && (uri.equals(parentUri))) // || uri.equals(""))) + && (uri.equals(parentUri) || uri.equals(""))) || DynamicElement.class.isAssignableFrom(bean) || DynamicElementNS.class.isAssignableFrom(bean) || addTypeMethods.size() != 0;