Attributes not populated when deserializing XML
-----------------------------------------------

         Key: XMLBEANS-273
         URL: http://issues.apache.org/jira/browse/XMLBEANS-273
     Project: XMLBeans
        Type: Bug

  Components: Binding  
    Versions: Version 2.1    
 Environment: JDK 1.4.2, Ubuntu 5.10
    Reporter: Gero Vermaas


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>

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

-- 
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


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to