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 ]
There is no emoticon for what I am feeling!
Joined: Sep 16, 2005
I should mention that the xml document that XMLBeans can't validate is being validated by the XML validator in my IDE (Eclipse), so I don't think I've made a mistake in the document, and the jar file scomp compiled from the XML schema is up-to-date.