I'm having trouble with something that should work like a dream. I'm using
Apache's XMLBeans (2.0.0 and then 2.1.0) to manipulate XML documents: to generate them and to read, validate, extract info from them.
One standard technique in XML Schemas is to define derived types: say B is derived from A by extension. Then, unless you've blocked it,
you should be able to use a B element where an A element is expected. So if the xsd defines:
Then you can do the following in a document:
But when I parse and validate, it keeps failing with exception "Invalid xsi:type qname: 'myns:B' in element d@
schema-url"! Does anyone know what's going wrong? I've also tried to generate a document in memory, where I call "d.setA(bObject)" to create what I described above, but when I output the XML, there is no xsi:type attribute. I've Googled and found articles like
(this: check out section on Extension and Restriction) which make it sound like what I'm doing should work. Help!
[ January 13, 2006: Message edited by: Jeff Albrechtsen ]