You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlbeans-user@xml.apache.org by my...@baunsgaard.dk on 2004/04/22 00:02:01 UTC
Can XMLBeans handle abstract ComplexTypes?
Hello all,
I've created an XML schema that has a hierarchy of complex types where the base type is abstract.
However, XMLBeans does not enforce that restriction - or have I misunderstood something?
A scaled-down sample:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:element name="Test" type="Base">
</xs:element>
<xs:complexType name="Base" abstract="true">
<xs:attribute name="Attribute" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="Derived1">
<xs:complexContent>
<xs:extension base="Base"/>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="Derived2">
<xs:complexContent>
<xs:extension base="Base"/>
</xs:complexContent>
</xs:complexType>
</xs:schema>
The schema (and java classes) should support either a Derived1 or Derived2 to be "added" to Test
and not a Base but the java classes supports adding Bases without problems. The resulting XML does
not validate.
Can anyone help me out on this one :)
BTW, I used the latest version 1 sources from CVS...
Thanks,
Hakon
- ---------------------------------------------------------------------
To unsubscribe, e-mail: xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/