Bug 37286 - MacroDef Element Namespaces
Summary: MacroDef Element Namespaces
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core (show other bugs)
Version: unspecified
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Ant Notifications List
Depends on:
Reported: 2005-10-28 05:43 UTC by Nicole Tedesco
Modified: 2008-11-24 03:58 UTC (History)
0 users

Partial Ant 1.6.5 schema (347.12 KB, text/xml)
2005-10-28 05:46 UTC, Nicole Tedesco

Note You need to log in before you can comment on or make changes to this bug.
Description Nicole Tedesco 2005-10-28 05:43:31 UTC
I personally would like a schema for Ant build files.  Sure, no schema could
ever be complete for Ant but a "good enough" schema could do in just about all
cases that most people will encounter and schema extensions may be able to fill
in the rest.  However, I could write a schema today if characteristics such as
the "name" attribute of the "element" element in MacroDefs could be specified
against a specific namespace.  If I could do that then I could write a schema
with lots of "any" elements validating against ##other namespaces and I could
make most of my build files validate quite cleanly while remaining quite flexible.

Any thoughts?
Comment 1 Nicole Tedesco 2005-10-28 05:46:17 UTC
Created attachment 16825 [details]
Partial Ant 1.6.5 schema

This partial Ant 1.6.5 schema relies on ##other namespacing and schema
extensions to enable flexibility
Comment 2 Nicole Tedesco 2005-10-28 21:57:30 UTC
I've thought about this a little more:

1. First get macrodef and taskdef to actually propagate the namespace down to de
nova attributes and elements.

2. Allow the attributes and elements in the *def body to be able to referred to
with the namespace prefix that had been previously mapped.  For instance:

	xmlns:foo="http://www.foo.com/ant" >


<target name="-init-macrodef-javac" depends="-init">
	<macrodef name="javac" uri="http://www.foo.com/ant">
		<attribute name="srcdir" default="${src.dir}"/>
		<attribute name="destdir" default="${build.classes.dir.real}"/>
		<attribute name="classpath"
		<attribute name="debug" default="${javac.debug}"/>
		<element name="customize" optional="true"/>
			<javac srcdir="@{srcdir}" destdir="@{destdir}" debug="@{debug}"
deprecation="${javac.deprecation}" source="${javac.source}"
target="${javac.target}" includeantruntime="false">
					<path path="@{classpath}"/>
				<compilerarg line="${javac.compilerargs}"/>

Not only does this help with schema development, but it also makes things a
little more readable (e.g., easily notice the difference between elements that
are there by original definition and those that were added).

If there is anything I can do (e.g., help code development) to make this happen
ASAP (that is, if is indeed a desirable feature) then I'll be glad to chip in.

Nicole Tedesco