You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2009/06/17 04:31:55 UTC
svn commit: r785468 -
/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/IriDecoderHelper.java
Author: dkulp
Date: Wed Jun 17 02:31:54 2009
New Revision: 785468
URL: http://svn.apache.org/viewvc?rev=785468&view=rev
Log:
[CXF-2294] Fix issue in http binding that is preventing code that works
with 2.0.11 to not work with 2.1 and 2.2.
Modified:
cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/IriDecoderHelper.java
Modified: cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/IriDecoderHelper.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/IriDecoderHelper.java?rev=785468&r1=785467&r2=785468&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/IriDecoderHelper.java (original)
+++ cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/IriDecoderHelper.java Wed Jun 17 02:31:54 2009
@@ -29,12 +29,14 @@
import javax.xml.XMLConstants;
import javax.xml.namespace.QName;
+import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.apache.cxf.common.i18n.BundleUtils;
import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.util.StringUtils;
import org.apache.cxf.helpers.DOMUtils;
import org.apache.cxf.helpers.IOUtils;
import org.apache.cxf.interceptor.Fault;
@@ -237,8 +239,10 @@
XmlSchemaSequence seq = (XmlSchemaSequence)cplxType.getParticle();
- Element e = doc.createElementNS(qname.getNamespaceURI(), qname.getLocalPart());
- e.setAttribute(XMLConstants.XMLNS_ATTRIBUTE, qname.getNamespaceURI());
+ Element e = doc.createElementNS(qname.getNamespaceURI(), "ns1:" + qname.getLocalPart());
+ Attr ns = doc.createAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "xmlns:ns1");
+ e.setAttributeNodeNS(ns);
+ ns.setNodeValue(qname.getNamespaceURI());
doc.appendChild(e);
if (seq == null || seq.getItems() == null) {
@@ -255,13 +259,18 @@
}
}
Element ec = null;
- if (unQualified) {
+ QName qn = elChild.getQName();
+ if (StringUtils.isEmpty(qn.getNamespaceURI()) && unQualified) {
ec = doc.createElement(elChild.getQName().getLocalPart());
} else {
- ec = doc.createElementNS(elChild.getQName().getNamespaceURI(), elChild.getQName()
- .getLocalPart());
+
if (!elChild.getQName().getNamespaceURI().equals(qname.getNamespaceURI())) {
+ ec = doc.createElementNS(elChild.getQName().getNamespaceURI(),
+ elChild.getQName().getLocalPart());
ec.setAttribute(XMLConstants.XMLNS_ATTRIBUTE, elChild.getQName().getNamespaceURI());
+ } else {
+ ec = doc.createElementNS(elChild.getQName().getNamespaceURI(),
+ "ns1:" + elChild.getQName().getLocalPart());
}
}