Probably I am missing something...
Can there be an element with two attributes with same namespace uri
and localName
i.e.

<sampleElement ns:attr="First Value" ns:attr="Different value for same
namespace(ns) and same localname (attr)">
</sampleElement>

Is the above a valid piece of XML?

If yes, what should one return when queried for value of ns:attr attribute.

Thank you
Jayachandra

On 5/19/05, Eran Chinthaka <[EMAIL PROTECTED]> wrote:
> 
> 
> Hi Jaya,
> 
> I also expected the same reply :) :).
> 
> See my comments below.
> 
> >
> > Hi Eran!
> > I predicted this reply :-)
> > Then, at least the names should be changed. Otherwise
> > readability&usability of code is at stake.
> > We can have
> > public Iterator getAttributesNS(OMNamespace ns) to do what you wanted to
> > do.
> >
> > And when syntactically only one attribute with a given qname
> > (namespace + localname) can exist in an element, calling a
> > getFirstAttribute(qname) wouldn't look nice.
> 
> You can construct a QName *only* giving the localName. So if I call
> getAttributes(new QName("localName")), you will get all the attributes with
> the same name, but with different namespace in a particular element.
> Well, at the sametime I know that this is a rare situation ;).
> 
> Anyway, I like to have a method to get all the attributes with a given
> namespace, with a given local name, with a give namespace uri. So the
> intention behind me providing that method was to answer that.
> 
> Any suggestions for a different signature to cater the above problem ??
> 
> > Can its signature be
> > changed to
> > public OMAttribute getAttribute(QName qname)
> 
> Nope this will return only the first matching one *only*. What is there are
> more than one in a particular element ??
> 
> So for this purpose I have put
> 
> + getFirstAttribute(QName):OMAttribute
> 
> Regards,
> Chinthaka
> 
> >
> > If the suggested changes sound agreeable can you do them at your
> > earliest convenience.
> >
> > Thank you
> > Jayachandra
> >
> > On 5/18/05, Eran Chinthaka <[EMAIL PROTECTED]> wrote:
> > > Nope.
> > >
> > > public OMAttribute getFirstAttribute(QName qname) throws OMException
> > will
> > > fullfil that thing.
> > >
> > > But the  public Iterator getAttributes(QName qname) method will do
> > something
> > > different.
> > >
> > > Well from this method what I expected was, one can just get give the
> > > namespace and get all the attributes with that same namespace, like
> > that.
> > > Well, I think I implemented this, but its now not in the source.
> > >
> > > Let me look at this.
> > >
> > > Regards,
> > > Chinthaka
> > >
> > > > -----Original Message-----
> > > > From: Glen Daniels [mailto:[EMAIL PROTECTED]
> > > > Sent: Wednesday, May 18, 2005 1:32 AM
> > > > To: [email protected]; 'jayachandra'
> > > > Subject: RE: [Axis2] OMElement API notes
> > > >
> > > >
> > > > You are quite right, Jaya.  That should get fixed.
> > > >
> > > > --Glen
> > > >
> > > > > -----Original Message-----
> > > > > From: jayachandra [mailto:[EMAIL PROTECTED]
> > > > > Sent: Tuesday, May 17, 2005 6:58 AM
> > > > > To: [email protected]
> > > > > Subject: [Axis2] OMElement API notes
> > > > >
> > > > > Resending with [Axis2] prefix
> > > > >
> > > > > ---------- Forwarded message ----------
> > > > > From: jayachandra <[EMAIL PROTECTED]>
> > > > > Date: May 17, 2005 4:27 PM
> > > > > Subject: OMElement API notes
> > > > > To: [email protected]
> > > > >
> > > > >
> > > > > Hi!
> > > > > I see the following method signature in OMElement.java
> > > > >   public Iterator getAttributes(QName qname);
> > > > >
> > > > > Should it not be something like
> > > > >   public OMAttribute getAttribute(QName qname);
> > > > >
> > > > > Can there be a list of (more than one) attributes with the same
> > qname
> > > > > in an element? Am I mistaken somewhere?
> > > > >
> > > > > Thank you
> > > > > Jaya
> > > > > --
> > > > > -- Jaya
> > > > >
> > > > >
> > > > > --
> > > > > -- Jaya
> > > > >
> > > > >
> > >
> > >
> >
> >
> > --
> > -- Jaya
> >
> 
> 
> 
> 


-- 
-- Jaya

Reply via email to