users@jaxb.java.net

Unmarshalling extended complexTypes

From: Raj Singh <raj_at_rajsingh.org>
Date: Wed, 21 Jul 2004 15:29:14 -0400

Hi group:

1. I have an XML Schema that has the following rules:
   complexType B is extended from complexType A.
   element C contains an unbounded sequence of elements named D of type
A.
   (example at: http://web.mit.edu/rajsingh/www/xml/test.xsd)

2. I write an XML file in which has a C element consisting of 1 D
element of type B.
   (example at: http://web.mit.edu/rajsingh/www/xml/test.xml)

Now, every schema validation tool I try says my XML file is OK. JAXB
validates the schema and generates the Java code. But when I try to
unmarshall the file, I get an exception when it gets to an elment in B
that isn't in A.

Is this on purpose, or a bug? What I want to say is that C elements can
have any type of data as long as it is based on A. I know I could use
the xsd:choice construct, but I don't want to, because specifying
exactly which objects are acceptable is less elegant from a modeling
perspective than just saying objects of a certain type are OK.


thanks,
Raj


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