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: Roles (was: antlib)
Date Fri, 02 May 2003 15:46:54 GMT
Yes, but more infrastructure is needed.
(Also, in current ant cvs, ComponentHelper is not used).

My knowledge on this subject is very small, but here
is my understanding (based on looking at jelly source
code).

To support XML ns one needs to know the uri associated
with the namespace prefix.

The same prefix may be associated with different uri in
the course of processing an xml file.

By overriding sax.helpers.DefaultHandler#startPrefixMapping
and #stopPrefixMapping, one can find out when the prefix
mapping space is active and when it is terminated. This is what
jelly does.

It would be more difficult (I may be wrong here) for ant to use
this information as resolving of most of  tags is done after the xml
parsing has completed.

It is not necessary to do this as .DefaultHander#startElement
does pass the uri that is associated with the element. This
could get stored in the UnknownElement and used for
name resolution. (Attributes would also be be considered).

Since namespace processing is active, the code should
use getLocalName and not getQName.

To support antlibs, I am thinking that one could have a
mapping table per uri (for element tags), either within
the ComponentHelper, or have a ComponentHelper per uri.

Peter


On Friday 02 May 2003 15:42, Costin Manolache wrote:
> peter reilly wrote:
>
> \>> > example:
> >> >     <typedef myfileset mypath anttest etc ..>
> >> >     <copy todir="output">
> >> >       <fileset ant-type="myfileset" dir="src"
> >> >                   newattribute="MyFileSet attribute"/>
> >> >     </copy>
> >> >
> >> >     <anttest>
> >> >       <path ant-type="mypath" path="build.xml"
> >> >                 newattribute="MyPath attribute"/>
> >> >     </anttest>
> >>
> >> I assume you meant to write "ant:type" instead of "ant-type"...
> >
> > No...
> > Ant does not have the infrastructure at the moment to support XML
> > namespaces, and their associated contexts.
>
> AFAIK ant _does_ have now the infrastructure to support and use
> XML namespaces.
>
> It is not using it - because we don't know yet what's the best way
> to do it, but AFAIK the infrastructure exists.
>
> ProjectHelper2 uses SAX2, it preserves namespaces in UnknownElement and
> the code for creation of tasks/types (ComponentHelper) receives the
> namespace and the name. CH allows plugins - i.e. any task can hook
> into the component creation and provide it's own mechanism, so you
> should be able to implement whatever namespace policy you want.
>
>
> Costin
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message