ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@apache.org>
Subject Re: Adding magic properties for targets?
Date Mon, 02 Jun 2008 14:47:01 GMT
James Fuller wrote:

> wouldn't it be great if property names were qnames and then we could do
> 
>   ant:default-target
>   ant:targets-invoked
> 
> though I do not think the default namespace e.g.
> antlib:org.apache.tools.ant is wholly appropriate as it concerns
> itself with ant libraries.
> 
> I know ant doesn't fully subscribe to all things xml ... but there
> maybe benefits to not reinventing things.

No, QNames are (a) evil (b) not part of XML; they ar part of the W3C XML 
Schema.
  I've just noticed the that Open Grid Forum's Open Grid Services 
Architecture mailing list has just discovered that very fact only weeks 
before their WS-ResourceFramework Basic Profile 1.0 was about to be 
announced (I'm on some very obscure mailing lists)...I think I pointed 
that out to them years back.

Here's the basic problem, and it exists in XPath too: you cannot 
evaluate the prefix to namespace URI mapping without building and 
maintaining the entire context of namespace declarations. And you get a 
new error type -unknown prefix- that is not needed. That is, it would be 
better to pass around things like

<qname>http://example.org#ename<qname>

Or even

<qname><uri>http://example.org</uri><localname>ename<localname><qname>

than it would be to have

<qname>example:ename</qname>
because you can only evaluate element within the context of the original 
scope.

Now imagine the <qname> task takes a property and sets it to the 
expanded http://example.org#ename string, and use it in a presetdef

<target xmlns:example="http://ant.apache.org"/>
<presetdef name="eval">
  <qname>example:ename</qname>
</presetdef>
</target>

and then I run it here

<target xmlns:example="http://somethingelse" >
    <eval property="evaluated" />
</target>

What gets expanded?

Or we run it here, where the namespace is entirely undefined:

<target >
    <eval property="evaluated" />
</target>


See? QNames are evil.

I had lunch with the W3C TAG last week, primarily to give them a hard 
time over releasing WS-Addressing without a single test case(*). I guess 
I should have raised QNames at the same time.

-Steve




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message