ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Reilly <peter.rei...@corvil.com>
Subject Re: DynamicConfigurator namespace problem
Date Fri, 12 Dec 2003 14:40:09 GMT
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: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message