Well, I had a JIRA opened for this (or very very similar) problem
http://issues.apache.org/jira/browse/AXIS2-1625?page=all, but it has
been closed with the explanation which didn't make to much sense to me.
Take a look if you are interested in.
 
Gul
 
 

________________________________

From: Vietchau Nguyen [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 16, 2006 11:51 AM
To: [email protected]
Subject: [Axis2] getAttribute call for OMElement



Hi all,

 

I have a simple call to getAttribute and I can't seem to call it
properly. I can use getAllAttributes() to get all of the attributes and
then go through them to find the one I'm looking for but it's not
efficient, and so any help is appreciated. I think I just miss something
very simple but I can't find it in any sample or questions.

 

Here is my code with getAllAttributes()

 

 

OMElement element;

Iterator<OMAttribute> OMAttIter = element.getAllAttributes();

        while (OMAttIter.hasNext()) {

            OMAttribute attri = OMAttIter.next();

            System.out.println(attri.getLocalName() + ": "+
attri.getAttributeValue());

        }

 

Here is the result from the above code:

 

arrayType: ns1:Language[2]

type: ns1:ArrayOfLanguage

Now, I want to call getAttribute, say "type" for example, and here is my
code:

 

OMAttribute attri = element.getAttribute(new QName("type"));

 

It didn't work (I get a null return), so next I tried the 2 following
cases:

 

OMAttribute arrayType = element.getAttribute(new QName("xsi", "type"));

 

and 

 

OMAttribute attri = element.getAttribute(new
QName(Constants.ATTR_TYPE));

 

They didn't work either. I always get a null return. So, I don't know
what to try next. Can anyone help me out how to call this function?

 

My goal actually is to find (1) whether it's an array, and if yes, (2)
what is the size... so if there is any other way to find out these
information, please advise me.

 

Thanks in advance for your help,

Vietchau

 

 

Reply via email to