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][OM] Simpler way to get NameSpace
Date Fri, 10 Dec 2004 07:07:53 GMT
Hold on a sec! Why would anyone need to search the document for all
the namespaces with a given prefix? I don't see any acceptable usecase
where the USER needs to handle such complexities.
As far as I am concerned the findnamespace method is concerned only
with the current element ! is it not? (you cant have more than one
namespace with a given prefix in that case) so that we should not
provide a lot of alternatives through a single method.


On Fri, 10 Dec 2004 12:55:56 +0600, Eran Chinthaka
<chinthaka@opensource.lk> wrote:
> 
> 
> 
> 
> >>
> >>Srinath Perera wrote:
> >>
> >>>>So, let me try to summarize where we are now w.r.t. namespaces:
> >>>>
> >>>>    interface OmNamespace {
> >>>>        public String getName (); // seems redundant to say
> >>>>getNamespaceName!
> >>>>        public String getPrefix ();
> >>>>    }
> >>>>
> >>>>
> >>>+1
> >>>
> >>>
> >>>
> >>>>OMElement has the following:
> >>>>
> >>>>    interface OmElement extends OmNode {
> >>>>
> >>>>
> >>why does this have to extend OmNode?
> >>
> >>>>        // declare a namespace at this element
> >>>>        public OmNamespace declareNamespace (String uri, String prefix);
> >>>>
> >>>>
> >>also declareNamespace(OmNamespace) to allow reuse of namespace
> >>declarations (perfectly fine and safe if OmNamespace is immutable)
> >>
> >>>>        // find a namespace declaration here or from parent
> >>>>        public OmNamespace findNamespace (String uri, String prefix);
> >>>>
> >>>>
> >>i guess:
> >>
> >>if prefix != null && uri != null find OmNamespace that has
> >>OmNamespace.getPrefix() == prefix && OmNamespace.getName() == uri
> >>if uri != null find OmNamespace that has OmNamespace.getName() == uri
> >>if prefix != null find OmNamespace that has OmNamespace.getPrefix() ==
> >>prefix
> >>
> >>what happens for findNamespace(null, null) ?!
> 
> [Chinthaka] I think having two methods is bit of a over doing.
> We can do the samething using one method.
> If u try to address the findNamespace(null, null) problem using two methods,
> u r in trouble again, as what if findNamespaceByPrefix(null) or
> findNamespaceByUri (null).
> 
> I think its better to have one method like
>        OmNamespace findNamespace (String uri, String prefix);
> If findNamespace(null,null), just throw an exception or return all. But if
> we want to return all there should be another method like
> Collection findNamespace (String uri, String prefix);
> 
> And there is one other problem.
> What if someone try to retrieve all the namespace which has some prefix.
> 
> Say findNamespace(null,prefix). SO this should return a collection. Or else,
> we document and say if there is more than one we just return the first one.
> 
> Comments ???
> 
> Regards
> -- Eran Chinthaka
> 
> 
> 
> >>
> >>maybe better is to have two functions?
> >>
> >>        public OmNamespace findNamespaceByPrefix (String prefix);
> >>        public OmNamespace findNamespaceByUri (String uri);
> >>
> >>
> >>>>        // get my namespace name
> >>>>        public String getNamespaceName ();
> >>>>
> >>>>        // get my local name
> >>>>        public String getLocalName ();
> >>>>
> >>>>        ..
> >>>>    }
> >>>>
> >>>>
> >>>+1 Think  we are converging :) are we ?
> >>>
> >>>
> >>looks good to me?
> >>
> >>--
> >>The best way to predict the future is to invent it - Alan Kay
> >>
> 
> 


-- 
Ajith Ranabahu

Mime
View raw message