You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Marc DEXET <Ma...@dsi.cnrs.fr> on 2004/10/12 09:46:46 UTC
[Jelly] [post again] Can a Tag get his own namespace ?
Hi.
I post again a question, if somebody who have missed the question and have a
answer.
Sorry if there's no answer :)
Imagine I get a set of implementation library like
<jelly xmlns:lib1="jelly:mylib:impl1" xmlns:lib2="jelly:mylib:impl2">
<lib1:createSomething/>
<lib2:createSomething/>
</jelly>
Each library implements the same interfaces.
in "createSomething" I would call a static factory method depending on each
implementation.
public void doTag(XMLOutput output) throws
MissingAttributeException, JellyTagException {
String createSomethingUri = {something};
TagLibrary lib = (TagLibrary)
context.get(createSomethingUri);
myObject = lib.getNewInstance();
}
But I dont find the {something} method to get the right uri.
How can I do ?
Thanks.
--
Marc DeXeT
RE: [Jelly] [post again] Can a Tag get his own namespace ?
Posted by Hans Gilde <hg...@earthlink.net>.
Marc,
You can use some combination of LocationAware and NamespaceAwareTag (yes,
inconsistent interface names). I haven't tried this personally, so please
let us know if it doesn't work. :)
LocationAware should give you the namespace-qualified tag name (which you
must parse to get the namespace). NamespaceAware gives you the
namespace-to-uri map for the current XML element.
Hans
-----Original Message-----
From: Marc DEXET [mailto:Marc.Dexet@dsi.cnrs.fr]
Sent: Tuesday, October 12, 2004 2:47 AM
To: Jakarta Commons Users List
Subject: [Jelly] [post again] Can a Tag get his own namespace ?
Hi.
I post again a question, if somebody who have missed the question and have a
answer.
Sorry if there's no answer :)
Imagine I get a set of implementation library like
<jelly xmlns:lib1="jelly:mylib:impl1" xmlns:lib2="jelly:mylib:impl2">
<lib1:createSomething/>
<lib2:createSomething/>
</jelly>
Each library implements the same interfaces.
in "createSomething" I would call a static factory method depending on each
implementation.
public void doTag(XMLOutput output) throws
MissingAttributeException, JellyTagException {
String createSomethingUri = {something};
TagLibrary lib = (TagLibrary)
context.get(createSomethingUri);
myObject = lib.getNewInstance();
}
But I dont find the {something} method to get the right uri.
How can I do ?
Thanks.
--
Marc DeXeT
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org