axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glen Daniels <>
Subject Re: [axiom] [axis2] getChildrenWithName() erroneous behavior
Date Tue, 03 Apr 2007 11:19:39 GMT
Hi Chinthaka!

Eran Chinthaka wrote:
>> Currently OMElement.getChildrenWithName(QName) uses the
>> OMChildrenQNameIterator to walk the list of children and return matches.
>>  Here's the problem - if there is no namespace (or no localName...
>> luckily that part isn't possible), the iterator will happily match ANY
>> element with a matching localName.  So for instance when we do this:
>> config_element.getChildrenWithName(new QName("transportSender"))
>> We'll get both <axisCfg:transportSender> and
>> <extension:transportSender>.  This is bad.  The above API call SHOULD
>> only match <transportSender> in no namespace.
> I did this purposely and I wanted to get matching nodes when I am not
> sure about the namespace. The idea I had in mind was, say if I have a
> SOAP message and and if I wanted to see whether the body contains a
> fault, then I can use the above method without worrying about which
> version of SOAP I am dealing with.

Unfortunately, XML is namespace aware, and if you're going to be using 
it, ESPECIALLY as the author of infrastructure code that is expected to 
be industrial-strength, you need to be rigorous about namespaces.  If 
you wrote code like you describe and got this:

     <myGeologyApp:Fault name="San Andreas">

...then that would be recognized as a SOAP fault (which wouldn't parse 
right anyway) and your poor user might not ever be able to receive their 
geological information.  There were a LOT of problems that were hidden 
in OM because of this kind of non-namespace-aware comparison.

> But if you want to clean this method and create another method, I'm ok
> with that too. But please please make sure we have
> OMElement.getChildrenWithLocalName(String). I am a poor user which needs
> that.

Sure, but our code really shouldn't be using it... :)


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message