users@jaxb.java.net

<xsd:extension> subclass elements do not get serialized on marshal

From: Naveen Ravindra <naveen.ravindra_at_ecanarys.com>
Date: Tue, 26 Jun 2007 03:33:25 -0700 (PDT)

Hi Team,
          I m using <xsd:extension> in a xml schema file say xsd2 which
extends an element of xsd1 and also adds few more attributes.

when i marshal the root element of xsd1 and when i substitute subclass
element of xsd2 extended incase of the element of xsd1, i will not be able
to see the attributes added for the extended element in xsd2.


xsd1

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:dp="http:///dp.ecore"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http:///dp.ecore">
<xsd:complexType name="Test">
        <xsd:sequence>
           <xsd:element maxOccurs="1" minOccurs="1" name="solution"
type="dp:Solution"/>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:string"/>
    <xsd:attribute name="date" type="xsd:string"/>
 </xsd:complexType>

<xsd:complexType name="Solution">
        <xsd:attribute name="Solutionid" type="xsd:string"/>
</xsd:complexType>
  
 <xsd:element name="Solution" type="dp:Solution"/>
<xsd:element name="Test" type="dp:Test"/>
</xsd:schema>

xsd2

<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:dcp="http://www.library.org" xmlns:dp="http:///dp.ecore"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.library.org">
        <xsd:import namespace="http:///dp.ecore" schemaLocation="xsd1.xsd" />
        <xsd:complexType name="Solution">
                <xsd:complexContent>
                        <xsd:extension base="dp:Solution">
                                
                                <xsd:attribute name="solutionName" type="xsd:string" />
                        </xsd:extension>
                </xsd:complexContent>
        </xsd:complexType>
        <xsd:element name="Solution" type="dcp:Solution"></xsd:element>
        
</xsd:schema>



now when i marshal root element of xsd1 which is <Test> i need solution to
have both the attributes

Solutionid from xsd1 and solutionName from xsd2.


Help at the earliest would be appreciated.

Regards,
Naveen Ravindra

-- 
View this message in context: http://www.nabble.com/%3Cxsd%3Aextension%3E-subclass-elements-do-not-get-serialized-on-marshal-tf3981620.html#a11303267
Sent from the java.net - jaxb users mailing list archive at Nabble.com.