Christopher Lenz wrote:

Am 12.12.2003 um 13:44 schrieb Peter Reilly:

Christopher Lenz wrote:

Same here. Proposed interface:

public class DynamicConfiguratorNS {

    public Object createDynamicElement(
        String namespaceURI,
        String prefix,
        String localName);

    public void setDynamicAttribute(
        String namespaceURI,
        String prefix,
        String localName,
        String value);

}


We could instead use  SAX style:
public class DynamicConfiguratorNS {

   public Object createDynamicElement(
       String namespaceURI,
       String localName,
       String qualifiedName);

   public void setDynamicAttribute(
       String namespaceURI,
       String localName,
       String qualifiedName,
       String value);


Personally, I prefer DOM style as it is higher-level. The qualifiedName parameter makes sense (well, sort of) when you can enable/disable namespace support. When namespace support is always enabled (as it is in Ant 1.6) the (namespaceURI, prefix, localName) partitioning makes more sense IMHO, and is easier to use.

The prefix is in any case nearly useless to the user: <dtest xmlns:ant="antlib:org.apache.tools.ant" xmlns:uri="uri"> <uri:local/> <ant:local/> <local/> <local xmlns="antlib:org.apache.tools.ant"/> </dtest>


However, I really think we should pass a NamespaceContext (working title) instead of the prefix, as explained in another post in this thread.

The problem with this is that the namespace context is only valid at parse time. So ant would have to remember the different contexts, and apply
them at runtime which is not too easy,
ex:
<dtest xmlns:a="1">
<a:x xmlns:b="2">
<b:x xmlns:a="3">
<a:x/>
</b:x>
</a:x>
</dtest>


Peter


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to