axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eran Chinthaka <chinth...@opensource.lk>
Subject Re: [AXIS2] How does Axiom handle namespaces in ancestor scopes?
Date Sun, 16 Apr 2006 12:38:02 GMT
Raymond Feng wrote:
> Hi,
>  
> I have an OM containment hiearchy as "SOAPEnvelope --> SOAPBody -->
> OMElement e1" and the namespace xmlns:ns1="http://ns1" is declared at
> the SOAPEnvelope level (I observe that It's the behavior when the
> SOAPEnvelope is received from the Axis2 engine).
>  
> XMLStream reader = e1.getXMLStreamReader();
>  
> For the reader, I found "reader.getNamespaceCount()" returns 0. Is it by
> design because the namespace "http://ns1" is not declared at e1 level?
> If so, it could be a problem if I pull events from the reader directly
> since the "http://ns1" won't be reported. What's the best way to
> populate namespaces from the ancestor scopes into e1?

According to StAX api
(http://java.sun.com/webservices/docs/1.5/api/javax/xml/stream/XMLStreamReader.html#getNamespaceCount())

"Returns the count of namespaces declared on this START_ELEMENT or
END_ELEMENT....".

So getNamespaceCount() should only return the namespace declared within
e1 element.

But if you call reader.getNamespaceURI() after START_ELEMENT of e1, you
should get http://ns1.

-- Chinthaka


Mime
View raw message