dcsimg
Prefix-to-namespace mappings from a custom task.
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Thursday, August 30, 2007 08:40 AM

Hi, Hopefully someone can help me or point me in the right direction here. I have a custom Ant task which I want to use to invoke another command which isn't known at compilation time. It uses an approach very similar to Ant itself, in that is builds the command from RuntimeConfigurables/UnknownElements. This all works but for running commands which have a prefix (such as my other custom commands). I want to be able to translate the prefix to a namespace uri that I can set with UnkownElement.setNamespace( uri ). For clarity, this is a simplified form of what I want to do. (I realise the example doesn't make a great deal of practical sense in this form; this is just for illustrative    More>>

Hi,


Hopefully someone can help me or point me in the right direction here.


I have a custom Ant task which I want to use to invoke another command which isn't known at compilation time. It uses an approach very similar to Ant itself, in that is builds the command from RuntimeConfigurables/UnknownElements. This all works but for running commands which have a prefix (such as my other custom commands).


I want to be able to translate the prefix to a namespace uri that I can set with UnkownElement.setNamespace( uri ).


For clarity, this is a simplified form of what I want to do. (I realise the example doesn't make a great deal of practical sense in this form; this is just for illustrative purposes :) ).


			

xmlns:myprefix="http://some.uri"
>

uri="http://some.uri"
classpath="mylib.jar"
/>







...





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 taskname, but I don't know how to get the namespace 'http://some.uri' programmatically at this point. Is there a way to access the namespace mappings defined in the build script that invokes taskrunner?


Thanks in advance.

   <<Less
About | Sitemap | Contact