ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "CJ" <>
Subject Re: Re: Accessing build script's prefix-to-namespace uri mappings from a task.
Date Mon, 03 Sep 2007 14:22:05 GMT

>On 9/3/07, Steve Loughran <> wrote:
>> CJ wrote:
>> > I want to be able to translate the prefix to a namespace uri that I can
>> > make the correct UnkownElement.setNamespace( uri ) call.
>> >
>> > For clarity, this is a simplified form of what I want to do. (I realize
>> >     <myprefix:taskrunner>
>> >         <atask name="myprefix:mytaskname">
>> >             ...
>> >         </atask>
>> >     </myprefix:taskrunner>
>> > Taskrunner is what I'm trying to get working, so it executes the task
>> > just as Ant would when parsing the xml form above it. I am parsing the
>> > 'myprefix' from the task name (atask's name attribute), but I don't
>> > know how to get the namespace 'http://some.uri' programmatically at
>> > this point.
>> There's nothing in ant to do this yet, though you could probably write a
>> task (which we would gladly accept, esp if it came with docs and tests :),

I may just be being daft but I'm not sure how a task would be able to do this
if the information isn't exposed to any tasks anyway.

>This is something that needs to be in ant-core. At the moment the prefix
>namespace mapping is not retained.
>It can be a little complicated,
>as UEs can get copied and modified - macrodef for exmple.

OK. Thanks for your replies. I needed to get other things working so I
bodged around it by adding support for nested <prefixmap> elements. Knowing
all the namespaces that will be used, this is still good. It would have
been nice to have the task handle it all automatically but at least it isn't
hard-coded inside the task itself.

Thanks anyway.

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

View raw message