users@jaxb.java.net

Re: InstantiationException when unmarshalling fpml instance document

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 10 Apr 2006 18:07:50 -0700

Hunter Stern wrote:
> The Document class maps to the abstract element
> Document:
>
> <xsd:complexType name="Document" abstract="true">
> <xsd:annotation>
> <xsd:documentation xml:lang="en">The abstract base
> type from which all FpML compliant messages and
> documents must be derived.</xsd:documentation>
> </xsd:annotation>
> <xsd:attributeGroup ref="StandardAttributes.atts"/>
> </xsd:complexType>
>
> The Document class is implemented by the DataDocument
> class which is the element specified by the "type"
> attribute in the instance document, <FpML
> version="4-1" xsi:type="DataDocument", why doesn't
> jaxb try to instantiate the DataDocument class instead
> of Document?

It should. It must be failing to resolve xsi:type="DataDocument".

1. register ValidationEventHandler on the unmarshaller and dump reported
errors.
2. how are you creating JAXBContext. Does it know about the DataDocument
class?

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com