[ 
http://issues.apache.org/jira/browse/WSCOMMONS-10?page=comments#action_12375341 
] 

Glen Daniels commented on WSCOMMONS-10:
---------------------------------------

> FYI : The correct solution for this is to implement the NamespaceContext in 
> our parser wrapper.

Sure.  But that means both a) we should implement getNamespaceContext(), and b) 
we should ensure that getNamespacePrefix()/getNamespaceURI() work correctly.

> So shall we agree to fix this for 1.1 and wait for 1.0, please ? 

Hm - I would really much rather fix this now.  The current situation seems to 
be as follows - I can't hand an XMLStreamReader which I've gotten from a 
pre-built OM to another piece of code (databinding, XQuery engine, whatever) 
and expect that the namespace mappings will work.  Right?  If so, this is awful 
if I've got any QNames that the application needs to resolve itself (in 
attribute / element values)!  Plus, I would think getNamespaceContext() gets 
some actual use, and if we don't support it no code that uses it will work with 
our reader....

+1 to fix this in 1.0.


> Request to have a utility method to get a copy of child OMElement whose 
> namespaces may be declared at parent OMElements
> -----------------------------------------------------------------------------------------------------------------------
>
>          Key: WSCOMMONS-10
>          URL: http://issues.apache.org/jira/browse/WSCOMMONS-10
>      Project: WS-Commons
>         Type: Improvement

>   Components: AXIOM
>     Reporter: Raymond Feng

>
> Here's the topic we discussed at Axis2 mailing list.
> 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
> Raymond Feng wrote:
> > Hi, Eran.
> > 
> > Thanks for the reply. I understand your point. But it also means that
> > e1.getXMLStreamReader() returns a reader pointing to the XML fragment
> > which is only valid with the parent chain.
> > 
> > Another way to ask the question would be:
> > 
> > Is there any utility to detach/clone the child OMElement so that it can
> > be used as a standalone OMElement with all the required namespaces
> > declared/populated?
> The straight answer is no.
> Detach was implemented to ease some one from handling the pointers here
> and there, in the case of llom implementation or any other implementation.
> If this seems useful, please file a JIRA and I will implement this when
> I get a chance :).
> -- Chinthaka

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to