ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Fuller" <>
Subject XML Namespace avoids collision between xml vocabularies was RE: a comment about xml namespace
Date Sun, 28 Dec 2003 12:28:46 GMT

> From: Jose Alberto Fernandez []
> Sent: 23 December 2003 11:44
> Subject: RE: a comment about xml namespace

> Given the above, what do you mean by namespaces "ANT does not know"

[Jim Fuller] Ant has no concept of what to do with 'other' namespaces
other then treat them as an error. XML namespaces is being used as an
abstraction to assist Ant extensibility, e.g. with respect to Antlib
etc... . XML namespaces were originally conceived as a method to allow
for multiple xml vocabularies to co-exist in the same XML document w/o
collision. A tertiary argument for allowing xml namespaces is that it
naturally segregates work to xml vocabularies that are more adept at
some purpose....thats why we have the wide range of ML's around today;
why continually add more elements to Ant when other xml vocabularies
will do? 

> about? Given (3) ANT cannot just ignore it, since it may be
> a typo of some sort. There is not such a thing as an ignorable

[Jim Fuller] Ant could 'ignore' it if it had a schema or DTD which Ant
would use ( perhaps it does, have not plumbed that deep into the code
yet)...since Ant does use an xml build file, why not validate it against
a schema...ok perhaps the problem here would be keeping up with schema
definition with extended tasks...or asking developers to provide
one...though XML Schema could simply accommodate for build file specific
macrodef, presetdef, antlib, taskdef situations....perhaps I am speaking
out of turn and all of this is in the pipeline for future versions.

> namespace (unless we define a way to tell to ANT to ignore it).

[Jim Fuller] I would propose to have an 'explicit' definition which
declares exactly what xml namespaces ant will process with all other
namespaced xml ( that may exist in an ant build file )to be ignored by
Ant. There maybe a few other Ant commandline switches or properties
needed to control this behavior.
> I see two ways here:
> 1) The already mentioned task Or type
> <comment> or better <ignore> in which you may be able to include any 
> XML you like. And hence keep anotations away boxed-off.
>   <ant:ignore>
>     <rdf:x xmlns:rdf="....">...</rdf:x>
>   </ant:ignore>

[Jim Fuller] yuk...why use namespaces at all if the intentions is to
introduce 'yet another mechanism' to avoid collision ??? I have
mentioned only a few use cases...pls don't think that they are purely
annotations(yes meta data) i.e. use cases are not necessarily benign
passive creatures, I see an benefit of Ant interacting with many other
XML vocabularies, standalone or otherwise generated by other software
development tools. I can understand that development effort should focus
on Ant functionality, and naturally will be Antcentric...I just think
for very little effort you can have a build.xml file that plays nice
within other XML processing environments, as well as bolstering Ant to
reuse XML technologies or at the very least respect the core reason why
xml namespaces avoid collision between elements and
attributes. I would think that with all the java code generation
happening from schemas (and vice versa) would see Ant building getting
very cozy with schema validation and processing...

> 2) Alternatively, one could think of using XML processing-instructions

> to tell ANT that some particular namespace should be ignored by ANT.
>   <?ant-ignore uri="...."?>
>   <rdf:x xmlns:rdf="....">...</rdf:x>

[Jim Fuller] XML PI's double yuk....why not just define an external xml
file which defines how namespaces are processed....I believe that you
could use/extend something like James Clark Namespace routing language
( as a format for such a
document. This would allow you to have a standard definition for Ant
processing as general, though gives a nice logical abstraction for
extensibility. I would be interested in assisting here, as EXSLT and my
other xml bits/bobs are tapering off with XSLT 2.0 approaching. Though
perhaps there is a bit of WIKI work would be logical first stop.
> The different approaches may produce quite different functionality, 
> while in (1) all foreign URIs segregated appart from the rest of the 
> ANT lingo, on (2) we could actually intermix them freely:
>   <?ant-ignore uri="...."?>
>   <project ... xmlns:rdf="....">
>     <rdf:x >...</rdf:x>
>     <target name="xyz" rdf:description="This is my description">
>       <copy ....>
>         <rdf:comment>This is a comment inside the code</rdf:comment>
>         <fileset ..../>
>       </copy>
>     </target>
>   </project>
> Which would produce a very powerful intermingling capability, but it 
> may be too powerful (i.e., too confising for the uninitiated).

[Jim Fuller] having just xml with different namespaces is all you
need...and yes xml namespaces can be confusing, which his why you have
the default namespace always process in Ant...
> (1) should be trivial to do in 1.7, (2) would require changes in 
> ProjectHelper to implement the processing-instruction.

> This I do not buy (yet). Certaintly you can resolve this by having the

> sensitive info in an encripted file and having a task that loads the 
> information during the execution of the build. You can write the task 
> to use whatever technology you want it to use.

[Jim Fuller] I think the operative word here is 'yet', people don’t do
things on the 80% because its too hard...or not enough time.... I agree
that this is a weak use case, give me a shout if you want me to spend
some real time generating some use cases... 

+1 for allowing Ant to ignore namespaces it doesn’t know what to do
with, or perhaps a processing switch that turns on/off such behavior. I
believe something like this is deigned for Ant 1.7, which would be all
that’s needed in the short term.

many thx, happy holidays, Jim Fuller

Jim Fuller Technical Architect PINX ltd / WebComposite s.r.o. / /
Co-Author ISBN 1861007213 Professional PHP4 XML
Co-Author ISBN 1861008074 Professional PHP Web Services
Technical Reviewer 'Beginning XSLT', 'Beginning Databases',
‘XML Antipatterns’ and various other xml / web service books
Most Recent speaking Engagement: International Web Services Conference
in Toronto 2003 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message