axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ajith Ranabahu <ajith.ranab...@gmail.com>
Subject Re: [Axis2] OMElementImpl notes
Date Tue, 26 Apr 2005 03:35:12 GMT
Hi,
having a global namspace table will definitley improve the memory usage but 
sadly it is not going to help us a lot in this situation. Somebody has to 
put the reference in the object!. 
One solution I can think of is to have the XML namespace entry as the 
default for all the newly created elements. So unless the namespace is 
explicitly changed, it will stay at the default one.

On 4/26/05, Eran Chinthaka <chinthaka@opensource.lk> wrote:
> 
> Hi all,
> 
> Declaring the default namespace in the document element will only help 
> when
> you are building the object structure through a builder. But this will not
> happen if you create the object structure programmatically.
> 
> So one option to these kinds of things and to many of the others is to 
> have
> a global namespace table per model.
> This is being considered during current OM clean up process.
> 
> I can remember once Alek proposed something like this long time back.
> 
> Any suggestions on this ??
> 
> -- Chinthaka
> 
> > -----Original Message-----
> > From: jayachandra [mailto:jayachandra@gmail.com]
> > Sent: Monday, April 18, 2005 1:01 PM
> > To: axis-dev@ws.apache.org
> > Cc: Ajith Ranabahu
> > Subject: Re: [Axis2] OMElementImpl notes
> >
> > 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 <aslom@cs.indiana.edu> 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* <jayachandra@gmail.com
> > > > <mailto:jayachandra@gmail.com>> 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 < jayachandra@gmail.com
> > > > <mailto:jayachandra@gmail.com>> 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
> >
> 
> 


-- 
Ajith Ranabahu

Mime
View raw message