Hi there.
I'm having a problem which I hope is a simple one... Any help would be
appreciated. I think it has something to do with the way attributes are
(or are not) inherited in schemas...
This is the content of my XML Schema (minus the schema tag):
<xsd:complexTyp e name="AType">
<xsd:attribut e name="attr1" type="xsd:strin g" />
<xsd:attribut e name="attr2" type="xsd:strin g" />
</xsd:complexType >
<xsd:complexTyp e name="BType">
<xsd:complexCon tent>
<xsd:extensio n base="AType">
<xsd:attribut e name="attr3" type="xsd:strin g" />
</xsd:extension>
</xsd:complexCont ent>
</xsd:complexType >
<xsd:element name="mydoc">
<xsd:complexTyp e>
<xsd:choice maxOccurs="unbo unded">
<xsd:element name="a" type="AType"/>
<xsd:element name="b" type="BType"/>
</xsd:choice>
</xsd:complexType >
</xsd:element>
In my instance document, I simply want to be able to do the following:
<mydoc xmlns="http://foo.org/foo.xsd">
<a attr1="1" attr2="2"/>
<b attr1="1" attr2="2" attr3="3"/>
</mydoc>
Whenever I try to validate the document, however, I get an error that
attr1 and attr2 are not valid for <b>. But <b> is of BType which
extends AType and attr1 and attr2 are defined for AType. What am I missing?
Thanks in advance,
Sean