James Mao wrote:
> Hi,
>
> I have a schema like this,
>
> <xs:complexType name="Meta">
> <xs:sequence>
> <xs:element name="name" type="xs:string"/>
> <xs:element name="description" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
>
> <xs:complexType name="Store">
> <xs:complexContent>
> <xs:extension base="Meta">
> <xs:sequence>
> <xs:element name="books" type="Book" minOccurs="1"
> maxOccurs="unbounded"/>
> </xs:sequence>
> </xs:extension>
> </xs:complexContent>
> </xs:complexType>
>
> <xs:element name="store" type="Store"/>
> <xs:element name="meta" type="Meta"/>
>
>
>
> Given the Store object, Is it possible for marshaller to generate the
> xml which looks like this
>
> <meta>
> <name>my book store>
> <description> abc </description>
> </meta>
OK, so you want to marshal Store as Meta? Is that right?
You can do so by creating a JAXBContext just from Meta, thereby causing
JAXB to treat your Store instances as Meta instances.
--
Kohsuke Kawaguchi
Sun Microsystems kohsuke.kawaguchi_at_sun.com