Marshaling objects that contain a property of empty abstract class type
-----------------------------------------------------------------------

                 Key: JIBX-406
                 URL: http://jira.codehaus.org/browse/JIBX-406
             Project: JiBX
          Issue Type: Bug
          Components: core
    Affects Versions: JiBX 1.2.2
            Reporter: Igor Nikolaev
         Attachments: jibx-sample.zip

Incomplete document after marshalling object. Here is my schema: 

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
elementFormDefault="qualified" attributeFormDefault="unqualified">
        <xs:complexType name="Container">
                <xs:sequence>
                        <xs:element ref="body"/>
                </xs:sequence>
                <xs:attribute name="version" use="required">
                        <xs:simpleType>
                                <xs:restriction base="xs:token">
                                        <xs:enumeration value="2-0"/>
                                </xs:restriction>
                        </xs:simpleType>
                </xs:attribute>
        </xs:complexType>

        <xs:complexType name="AbstractBody" abstract="true"/>

        <xs:complexType name="ConcreteBody">
                <xs:complexContent>
                        <xs:extension base="AbstractBody">
                                <xs:sequence>
                                        <xs:element name="simpleString" 
type="xs:string"/>
                                </xs:sequence>
                        </xs:extension>
                </xs:complexContent>
        </xs:complexType>

        <xs:element name="body" type="AbstractBody"/>
        <xs:element name="Container" type="Container"/>
</xs:schema>

The generated code is fine: I get abstract AbstractBody class with no 
properties and it's subclass ConcreteBody with simpleString property.

When I create object Container I assign body to ConcreteBody and I expect it to 
be marshalled. Instead I get following document:

<Container version="2-0">
    <body/> <!-- Notice empty body tag-->
</Container>

Expected document would be:

<Container version="2-0">
    <body>
        <simpleString>simpleString</simpleString>
    </body>
</Container>

I have attached sample project to this issue

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
jibx-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to