users@jaxb.java.net

Content model versus Element Model

From: Adrian Brogan <adrian.brogan_at_burnsecs.com>
Date: Tue, 21 Oct 2003 14:01:53 +0100

Sorry for being lazy, but I am under some tight deadlines and don't have
time to sit back and read/understand all the JAXB spec.
 
Could somebody tell me the key usages for the element model as opposed
to the content model classes generated by xjc.
 
Consider this schema fragment
 
  <xsd:element name="QUANTITY">
    <xsd:complexType mixed="false">
      <xsd:sequence>
        <xsd:element ref="QUANTITYAMOUNT" minOccurs="1" maxOccurs="1"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
 
  <xsd:element name="QUANTITYAMOUNT" type="xsd:decimal"/>
 
xjc generates interfaces named
 
QUANTITYType (content model)
QUANTITY (element model)
QUANTITYAMOUNT (element model)
 
It also generates implementation classes for these interfaces as follows
 
QUANTITYTypeImpl (content model)
QUANTITYImpl (element model)
QUANTITYAMOUNTImpl (element model)
 
I noticed that the amount is implemented as a BigDecimal as a property
of the QUANTITYTypeImpl class, whereas in the element model, the
QUANTITYAMOUNT is represented by it's own separate class ! Are both
models used when you unmarhsal an XML doc. I.e. is there effectively two
quantity amounts in memory at runtime.
 
Any advice would be appreciated.
 
Adrian
 
 




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net