Schema for element with Attributes and Child nodes
- by Matthew
I am trying to write xsd type schema for an element that has a custom type to include addition attributes to extend a base type. I am running into trouble getting the syntax right.
<xs:element name="graphs">
<xs:complexType>
<xs:sequence>
<xs:element name="graph"
minOccurs="1"
maxOccurs="unbounded"
type="graphType">
<!-- child elements -->
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="graphType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="title" type="xs:string"/>
<xs:attribute name="type" type="xs:string"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
I thought this would be something very common, but having read many tuts and forums, I cant seem to find an answer that works for me.