axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vietchau Nguyen" <vietchau.ngu...@eedo.com>
Subject [Axis2] getAttribute call for OMElement
Date Thu, 16 Nov 2006 16:50:47 GMT
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

 

 


Mime
View raw message