[jbossws-dev] [Design of JBoss Web Services] - Re: Why does DOMWriter copy namespaces?

jason.greene@jboss.com do-not-reply at jboss.com
Tue Oct 24 21:59:00 EDT 2006


Ah, I see.

I believe the repetition was limited to namespaces defined outside of the content element. This is easy to fix nonetheless.

There is also a problem with qname values.  Since only the namespaces that are actually used are declared when needed, and since only elements and attributes are looked at, there is the possibility that a qname element or a qname attribute will not have a defined namespace. JBWS-1303 demonstrates one example of this problem

Further, it is not possible to know if Text nodes or attribute values refer to a qname unless DOMWriter has knowledge of the schema (which is impractical for its purpose). Therefore, the only way to guarantee correct XML is to always copy all namespaces from all parent nodes to the start of a fragment (although using proper scoping).

I implemented this approach in my local tree, but unfortunately the extra namespace noise breaks 20 something tests. This is because the SOAP content element remains in string mode, thus the message is permanently altered. Since this is an undesirable side effect, and since the namespace modified string is only necessary when passing a fragment to an unmarshalling component, the xml string should really be a transient value.

Therefore I see two possible solutions.

1) Modify SOAPContentElement to no longer persist the xml string, and to only use it when unmarshalling is invoked. Also modify SAAJPayloadBuilder to use DOM. 

2) Wait for the DOM optimiations (JBWS-1314), and then modify our processing phase to do temporary alterations on the Element before passing to the unmarshaller.

Due to our heavy load, and our tight release schedule, I think we should go with 2. We can then just add workarounds on an as needed basis.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3980590#3980590

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3980590



More information about the jbossws-dev mailing list