Ajith! one entry at the document element namespace declaration is
enough. But how can we do that, even the root element is created by
builder just like any other OMElement only know. Am I missing
something? Is there a way how factory can know if its creating an
OMElement corresponding to root element.
Bye
Jaya
On 4/18/05, Aleksander Slominski <[EMAIL PROTECTED]> wrote:
> Ajith Ranabahu wrote:
>
> > Hi,
> > Yes, having such a statement in the constructor will be the solution
> > but personally i would like to see the namespace object coming through
> > the factory.
>
> it should go through factory so namespaces can be reused to keep memory
> usage low when namespace is the same in many elements/attributes.
>
> > Theoreticaly this namespace declaration should take place only in the
> > root element! So the tweak can also be done in the builder, is it not ?
>
> actually there is no need to have it in hashmap at all as it is always
> there so you can have it in your code ie.
>
> lookupNamespace(prefix) {
> if(prefix == "xml") {
> return "http://www.w3.org/XML/1998/namespace"
> } else if (hasmap != null) {
> uri = hashmap.get(prefix)
> if (uri != null) {
> return uri;
> } else if(parent != null){
> return parent.lookupNamespace(prefix)
> }
> }
> return null;
> }
>
> this is good as it allows to delay creation of hashmap to time when
> there is actual ns declaration to put into it.
>
> alek
>
> ps. in your declareNamespace(prefix, uri) make sure that user can not
> redefine "xml" prefix ...
>
> >
> >
> > On 4/13/05, *jayachandra* <[EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>> wrote:
> >
> > Sorry! the default uri for the prefix 'xml' should be
> > "http://www.w3.org/XML/1998/namespace" and the line of code that
> > should be added in the constructor(s) of OMElementImpl is
> >
> > declareNamespace( new
> > OMNamespaceImpl("http://www.w3.org/XML/1998/namespace", "xml"));
> >
> > Thanks
> > Jayachandra
> >
> > On 4/13/05, jayachandra < [EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>> wrote:
> > > Hi devs!
> > >
> > > In OMElementImpl the namespaces hashmap is initialized to null by
> > > default. This appears problematic. The XML-Infoset spec says
> > inscope
> > > namespace of an element info item must ALWAYS contain one entry for
> > > 'xml' prefix having the URI as "http://www.w3.org/2000/xmlns/".
> > > (Refer to http://www.w3.org/TR/xml-infoset/#infoitem.element and
> > look
> > > for [in-scope namespaces] property )
> > >
> > > Because of this simple thing we are loosing out on a good number of
> > > xml test cases from oasis where 'xml:base' kind of entries are
> > > frivolously used without bothering to declare the namespce for xml
> > > prefix explicitly.
> > >
> > > The following simple additional line of code in the
> > constructor(s) of
> > > OMElementImpl should solve the issue and increase the XML test suite
> > > conformance lot more.
> > >
> > > //By default entry for 'xml' prefix is always present as a
> > > in-scope namespace for every element
> > > namespaces.put("xml", new
> > > OMNamespaceImpl("http://www.w3.org/XML/1998/namespace", "xml"));
> > >
> > > Thank you,
> > > Jaya
> > > --
> > >
> >
> > --
> > -- Jaya
> >
> >
> >
> >
> > --
> > Ajith Ranabahu
>
> --
> The best way to predict the future is to invent it - Alan Kay
>
>
--
-- Jaya