axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jayachandra <jayachan...@gmail.com>
Subject Re: [Axis2] Proposal for adding a method in OMElement API.
Date Wed, 25 May 2005 10:39:36 GMT
Hi Eran!
Copying of parent's namespace stack is a bad idea. I too agree.
Currently that's not done in OM (except for may be for the one
namespace associated with the child element's tagname itself) neither
do we want it in OM in future. I guess, all that needs to be done for
a balanced implementation of removeNamespace method is to search
through the hashMap entries of just the element on which the method is
called, delete from the hash and retrun true if a matching namespace
is found or else just return a boolean false. We must not go up the
hierarchy to delete a namespace declaration.
The return code false must be enough hint for the user that the
specified namespace is not present in this element, hence couldn't be
deleted. If we want to help user more, just before returning a boolean
false, we can log some debug information something like...
log.debug("removeNamespace: Unable to find " + namespace.getName() +
":" + namespace.getPrefix() + " in the " + this.getQName().toString()
+ " OMElement. Returning false");

Does that sound agreeable?

Thanks
Jayachandra
On 5/25/05, Eran Chinthaka <chinthakae@gmail.com> wrote:
> Wait wait, we are missing something here.
> 
> Remember we have to think about the memory foot print as well. AXIOM is all
> about memory and performance.
> 
> If we copy parent's namespace stack to children, we are wasting memory.
> Isn't it. I agree that for us to better implement this remove namespace that
> is a good solution. But if you think about the common case, this is utter
> waste of memory.
> 
> <a>
>    <b>
>            <c/>
>    </b>
> </a>
> 
> Think: each element defines 10 namespaces, in your suggested approach, we
> will ended up with  60 hashmap elements. (10 from a, 20 from b and 30 from
> c). But the current implementation will have just 30 entries + just object
> references to the others.
> 
> Plus, even by doing this, will not solve the problem. What if you have some
> attributes with the namespace you gonna remove. We have to change them as
> well.
> 
> I agree that removeNamespace should be supported, but I have still no GOOD
> idea about, how to do it.
> 
> Comments/Suggestions ?
> 
> Chinthaka
> 
> ----- Original Message -----
> From: "jayachandra" <jayachandra@gmail.com>
> To: <axis-dev@ws.apache.org>; "Eran Chinthaka" <chinthakae@gmail.com>
> Cc: "Venkat Reddy" <vreddyp@gmail.com>; "Ajith Ranabahu"
> <ajith.ranabahu@gmail.com>
> Sent: Wednesday, May 25, 2005 2:51 PM
> Subject: Re: [Axis2] Proposal for adding a method in OMElement API.
> 
> 
> Hi Eran et al,
> Removing a namespace that child is using from a parent is certainly a
> user fallacy and not able to handle that, I guess, is not any
> compromise. If a user is following a API, he is expected to follow it
> in its spirit, we can't help it. If that were a blocking compromise,
> standardized SAAJ API will never have included the method, isn't it?
> In my honest opinion, it's good to have this innocuous method.
> 
> Regards
> Jaya
> 
> On 5/25/05, Eran Chinthaka <chinthakae@gmail.com> wrote:
> > Hi Venkat and all,
> >
> > >Okay - the usecase we have is the following method in SAAJ API on
> > >javax.xml.soap.SOAPElement:
> >
> > >boolean removeNamespaceDeclaration(java.lang.String prefix)
> >
> > >We can't implement this without the undelying OM design catering to such
> > >needs.
> >
> > >So here goes my +1 for implmenting this method on OMElement.
> >
> > >Regarding the uniqueness of prefix, i dont think it is an issue,
> > >because every element has its own hashmap object for namespaces, and
> > >for one prefix, there can be only one namespace in the scope, so
> > >removal such namespace will not affect other elements or other
> > >namespaces, i guess.
> >
> > Every element has a namespace map. But if a child is using a namespace
> > declared in the parent, that child is pointing to the parent for that. So
> > if
> > we remove the namespace from the parent, we have some trouble.
> >
> > I agree that u need a method like this for SAAJ impl. But how can we
> > compromise ?
> >
> > >When in doubt, lets vote :-)
> >
> > Is it a joke ? ;) ;).
> >
> > Regards,
> > - Chinthaka
> >
> > >- Venkat
> >
> >
> >
> > On 5/25/05, Ajith Ranabahu <ajith.ranabahu@gmail.com> wrote:
> > > Hi all,
> > > Well since our OMElementImpl keeps its own list of namespaces adding /
> > > declaring a namespace would affect that Element only. if the reference
> > > is
> > > removed from the parent I don't see a problem with the children since
> > > they
> > > keep their own reference to the particular namespace. We ask for a
> > > mandatory
> > > namespace at creation, rememebr ?
> > > The only thing that will not be elegant is the serialization.(I don't
> > > see
> > > a
> > > problem though. The serializer handles it right and generates a
> > > sematically
> > > valid XML. That generated XML is not elegant)
> > > So even though a non-used namspace does no harm (except serializing it
> > > on
> > > the declared element making the XML ugly)  we can techinically remove it
> > > without a problem.
> > >
> > > On 5/25/05, Eran Chinthaka <chinthakae@gmail.com> wrote:
> > > > Hi Jaya and all,
> > > >
> > > > I still find difficult to give you a method to remove namespaces.
> > > >
> > > > Namespaces, once defined in an element, that will be used by all of
> > > > its
> > > > children. So if we try to remove a namespace, that will be a total
> > > > mess.
> > > > Isn't it ?
> > > >
> > > > So I'm in doubt to give *any* of the methods to remove namespaces
> > > > .....
> > > >
> > > > Regards,
> > > > Chinthaka
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Ajith Ranabahu
> >
> >
> 
> 
> --
> -- Jaya
> 
> 


-- 
-- Jaya

Mime
View raw message