users@jaxb.java.net

JAXB customization to generate flat (less hierarchal) Java class

From: dhai <sdhari_at_hotmail.com>
Date: Thu, 23 Apr 2009 00:33:21 -0700 (PDT)

<xs:element name="car">
        <xs:element name="engine">
                <xs:element name="engineNumber" type="xs:string"/>
                <xs:element name="enginePower" type="xs:float"/>
        </xs:element>
        <xs:element name="body">
                <xs:element name="colour" type="xs:string"/>
                <xs:element name="length" type="xs:float"/>
        </xs:element>
</xs:element>

JAXB compiler creates following three classes for the above schema.

class Car{
        protected Engine engine;
        protected body body;
}
class Engine{
        protected String engineNumber;
        protected float eninerPower;
}
class Body{
        protected String colour;
        protected float length;
}

I need a flat bean to access all the attribute from a single class. I need
JAXB to generate the following class. I don’t have option to change xsd and
upcoming xml request. Of course I don’t just want class generation but also
want marshalling/unmarshalling work successfully.

class car{
        protected String engineNumber;
        protected float eninerPower;
        protected String colour;
        protected float length;
}
-- 
View this message in context: http://www.nabble.com/JAXB-customization-to-generate-flat-%28less-hierarchal%29-Java-class-tp23191755p23191755.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.