[ http://issues.apache.org/jira/browse/WSCOMMONS-10?page=comments#action_12375382 ]
Raymond Feng commented on WSCOMMONS-10: --------------------------------------- I would appreciate if it can be fixed it in 1.0. :-) In fact, the problem I'm facing is to load the payload in the SOAPBody into a SDO data object using the XMLStreamReader and it fails due the namespace issue. That's the same situation as Glen descibed. Thanks, Raymond > 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
