C# Help: Adding a complexType to the main XmlSchema
- by G33kKahuna
I need to create program that creates a XML schema like below using System.Xml.XmlSchema namespace
I'm using the XmlSchemaComplexType to MyString and MyInteger but I can't seem to find a way to set the extension to base string and int respectively.
Any guidance is much appreciated ... thanks
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="MyString">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="modified" type="xs:boolean" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="MyInteger">
<xs:simpleContent>
<xs:extension base="xs:int">
<xs:attribute name="modified" type="xs:boolean" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="data">
<xs:complexType>
<xs:sequence>
<xs:element name="row">
<xs:complexType>
<xs:sequence>
<xs:element name="order_id" type="MyInteger" />
<xs:element name="order_status" type="MyString" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>