Perhaps you haven't shown everything that pertains to the problem. Using
a required element with an abstract type creates the unresolvable
contradiction that an object in the (Java) object tree must be present so
that an XML element <Content xsi:nil="true"> can be marshalled.
Therefore, one option would be to omit "abstract".
Also, consider
<quote URL="
http://www.w3.org/TR/xmlschema-1/#Complex_Type_Definitions">
Complex types for which
{abstract}<
http://www.w3.org/TR/xmlschema-1/#ct-abstract>is
*true* must not be used as the {type
definition}<
http://www.w3.org/TR/xmlschema-1/#type_definition>for the
·validation· <
http://www.w3.org/TR/xmlschema-1/#key-vn> of element
information items. It follows that they must not be referenced from an xsi:type
(§2.6.1) <
http://www.w3.org/TR/xmlschema-1/#xsi_type> attribute in an
instance document. Abstract complex types can be used as {base type
definition} <
http://www.w3.org/TR/xmlschema-1/#ct-base_type_definition>s, or
even as the {type
definition}<
http://www.w3.org/TR/xmlschema-1/#type_definition>s
of element declarations, provided in every case a concrete derived type
definition is used for ·validation·<
http://www.w3.org/TR/xmlschema-1/#key-vn>,
either via xsi:type (§2.6.1) <
http://www.w3.org/TR/xmlschema-1/#xsi_type> or
the operation of a substitution group.
</quote>
-W
On Mon, Dec 28, 2009 at 1:27 PM, Finsener <finsener_at_hotmail.com> wrote:
>
> Hi!
>
> Can I have my super type objects to include a field of abstract type that
> is
> nillable="true".
>
> If the object of an abstract object it is not set, I get an exception while
> unmarshalling: [org.xml.sax.SAXParseException: cvc-type.2: The type
> definition cannot be abstract for element Content.]
>
> xsd is like following (marsalling A):
>
> <xsd:complexType name="AType">
> <xsd:sequence>
> <xsd:element name="Content"
> type="p:C" nillable="true" />
> </xsd:sequence>
> </xsd:complexType>
>
> <xsd:element name="A" type="p:AType" />
>
> <!-- CS ABSTRACT CONTENT -->
>
> <xsd:complexType name="C" abstract="true" />
> --
> View this message in context:
> http://old.nabble.com/Null-and-abstract-tp26942526p26942526.html
> Sent from the java.net - jaxb users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>