Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-2510

XMLBEANS_NAMESPACE_HACK alternative is missing in case of XmlBeans data binding

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.1.8, 2.2.5
    • Component/s: OtherDatabindings
    • Labels:
      None

      Description

      MAIN DESCRIPTION

      Is there a chance to port the XMLBEANS_NAMESPACE_HACK feature from XFire to CXF?

      Here is a reference: http://xfire.codehaus.org/XMLBeans+Integration

      PROBLEM

      CXF always use XMLBeans XMLStreamReader to write to the outgoing xml stream.

      There is a number of issues related to namespaces when this reader is used, e.g.:

      1. It either fails to read info or fails to write info in some cases.

      2. Namespaces are duplicated for each element even with
      the fix http://issues.apache.org/jira/browse/CXF-2468

      If there was an opportunity to switch CXF to use XMLBeans DOM as a source object
      instead of XMLStreamReader then I suppose these issues would be resolved.

      BACKGROUND - SOME XFIRE SOURCES

      xfire-1.2.4\xfire-xmlbeans\src\main\org\codehaus\xfire\xmlbeans\XmlBeansType.java

      Here is an excerpt from the XmlBeansType.writeObject(..) method:

      if (Boolean.valueOf((String) context.getContextualProperty(XMLBEANS_NAMESPACE_HACK)).booleanValue())
      {
      Object o = obj.newDomNode();
      if (o instanceof Document)

      { org.w3c.dom.Element e = ((Document) o).getDocumentElement(); STAXUtils.writeElement(e, xsw, false); }

      else if (o instanceof DocumentFragment)
      {
      DocumentFragment frag = (DocumentFragment) o;

      NodeList nodes = frag.getChildNodes();
      Node node = nodes.item(0);
      nodes = node.getChildNodes();
      for (int i = 0; i < nodes.getLength(); i++)

      { STAXUtils.writeNode(nodes.item(i), xsw, false); }

      }
      else

      { throw new XFireRuntimeException("Invalid document type returned: " + o); }

      }
      else

      { XmlCursor cursor = obj.newCursor(); STAXUtils.copy(cursor.newXMLStreamReader(), ((ElementWriter) writer).getXMLStreamWriter()); }

        Attachments

          Activity

            People

            • Assignee:
              dkulp Daniel Kulp
              Reporter:
              mklimiuk Michael Klimiuk
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: