1
votes

i am trying to use tha jaxb to marshall xml i used the xjc command to generate java classes from an xsd file : order.xsd

<?xml version="1.0"?>
<!-- version 2.10 -->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:include schemaLocation="c.xsd"/>
<xsd:element name="csa" type="param"/>
<xsd:complexType name="param">
    <xsd:all>
        <xsd:element name="User" type="alpha50" minOccurs="0"/>
        <xsd:element name="Infos" type="infosType"/>
        <xsd:element name="Params_Leg" type="params_LegType"/>
        <xsd:element name="Commande" type="commandeType"/>
    </xsd:all>
    <xsd:attribute name="version" type="xsd:decimal"/>
</xsd:complexType>
<!-- Atos / Command Parameters tree type -->
<xsd:complexType name="commandeType">
    <xsd:all>
        <xsd:element name="Mode" type="modeType"/>
        <xsd:element name="Etat" type="etatType"/>
                       <xsd:element name"IP" type="urlType">
    </xsd:all>
</xsd:complexType>
</xsd:schema>

I get many annotated classes however none of them @XmlRootElement(name = "Order") and no classe named Order

1

1 Answers

0
votes

A class will be generated for each complex type and global elements with anonymous complex types. In your XML schema it appears as though the root element is csa. The csa element has a named complex type called param so you will want to create an instance of Param. The generated ObjectFactory class will have a convenience method for wrapping it in the csa element.

For More Information