Click to See Complete Forum and Search --> : complexType with child element containing some attribbute


ngquochung86
03-25-2009, 09:03 PM
For example if we have a complexType element and it has some child element inside it , and that complexType element also have an attribute
so my question is:
does the simpleContent tag appear before or after the sequence tag?
For instance, here is my piece of code, but it is still not valid yet, I don't know why.
Would you guys please help me? Thank you
<xs:element name="census">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs::integer">
<xs:attribute name="date" type="xs:integer"/>
</xs:extension>
</xs:simpleContent>
<xs:sequence>
<xs:element ref="censustaker"/>
<xs:element ref="address"/>
<xs:element ref="occupants"/>
</xs:sequence>
</xs:complexType>
</xs:element>

jkmyoung
03-26-2009, 01:19 PM
The problem is more to do with the mixed content. Ideally, you should have a seperate element for the value of this parent element.

ngquochung86
03-26-2009, 08:51 PM
Thanks, I've make it
<xs:element name="census">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element ref="censustaker"/>
<xs:element ref="address"/>
<xs:element ref="occupants"/>
</xs:sequence>
<xs:attribute name="date" type="xs:integer"/>
</xs:complexType>
</xs:element>
<xs:element name="data">