Uploaded image for project: 'XMLBeans'
  1. XMLBeans
  2. XMLBEANS-273

Attributes not populated when deserializing XML

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • Version 2.1
    • None
    • Binding
    • None
    • JDK 1.4.2, Ubuntu 5.10

    Description

      I'm attempting to deserialize the following XML. It all seems to work OK, but the attributes of the resulting XmlObject subclass are not populated. I isolated the case into a unit test.Below are the:

      • XML Message being parsed
      • The code used to parse it
      • Parts of the XSDs

      A clue might be the fact that this is the first time I'm deserializing something that has a "choice" element....

      === XML Message being parsed ===
      <makeOrderValueException
      xmlns="http://java.sun.com/products/oss/xml/ServiceActivation"
      xmlns:co="http://java.sun.com/products/oss/xml/Common"
      xmlns:ri="http://www.ossj.org/RiServiceActivation"
      xmlns:sa="http://java.sun.com/products/oss/xml/ServiceActivation"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ossj.org/ServiceActivation">
      <co:IllegalArgumentException>
      <message>javax.oss.IllegalArgumentException: Order type non.existing.OrderValue ist not supported
      javax.oss.IllegalArgumentException: Order type non.existing.OrderValue ist not supported
      </message>
      </co:IllegalArgumentException>
      </makeOrderValueException>

      === The unit test code ===

      ClassPathResource res = new ClassPathResource("illegalAttributeException.xml");

      MakeOrderValueExceptionDocument exDoc = MakeOrderValueExceptionDocument.Factory.parse(res.getInputStream());
      MakeOrderValueException move = exDoc.getMakeOrderValueException();

      log.debug("testIllegalAttributeException() exDoc: " + move.xmlText()); // <- Shows correct XML

      assertTrue(move.isSetIllegalArgumentException()); // <-- FAILS
      assertNotNull(move.getIllegalArgumentException()); // <-- FAILS

      === XSD parts from "co" schema (http://java.sun.com/products/oss/xml/Common) ===

      <complexType name="BaseException" abstract="true">
      <annotation>
      <documentation>a</documentation>
      </annotation>
      <sequence>
      <element name="message" type="string">
      <annotation>
      <documentation>The Message element indicates the error message from the Exception. This is most
      likely the results from a Exception.getMessage() call.</documentation>
      </annotation>
      </element>
      </sequence>
      </complexType>

      <complexType name="IllegalArgumentException">
      <annotation>
      <documentation>The IllegalArgumentException exception is
      returned by the OSS through Java XML/JMS interface to report
      that the request could not be completed because one of the
      arguments passed in is invalid.</documentation>
      </annotation>
      <complexContent>
      <extension base="co:BaseException">
      <sequence/>
      </extension>
      </complexContent>
      </complexType>

      <complexType name="RemoteException">
      <annotation>
      <documentation> The RemoteException is returned when an
      errors occurs during any remote object
      operation.</documentation>
      </annotation>
      <complexContent>
      <extension base="co:BaseException">
      <sequence/>
      </extension>
      </complexContent>
      </complexType>

      ==== XSD parts from default schema (http://java.sun.com/products/oss/xml/ServiceActivation) ====

      <element name="makeOrderValueException">
      <annotation>
      <documentation>This is returned if an exception
      occurrs.</documentation>
      </annotation>
      <complexType>
      <choice>
      <element name="illegalArgumentException" type="co:IllegalArgumentException"/>
      <element name="remoteException" type="co:RemoteException"/>
      </choice>
      </complexType>
      </element>

      ==================

      Attachments

        Activity

          People

            Unassigned Unassigned
            gero Gero Vermaas
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: