<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="Conformance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="" xmlns:sch="http://www.ascc.net/xml/schematron">
    <xs:annotation>
        <xs:documentation>
            C# XML Comments Schema. By Daniel Cazzulino, 2002
            Note that there are several undocumented elements and attributes, 
            which were added to validate the mscorelib.xml file. 
            Other well-formed XML elements can be added only if they use a non-empty namespace.
            This is a limitation due to the "non-deterministic" schema caracteristic that would
            appear if we allow elements such as <xs:any processContents="skip" />.
        </xs:documentation>
    </xs:annotation>
    <xs:element name="doc">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="assembly">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1" />
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="members">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="member" maxOccurs="unbounded">
                                <xs:complexType>
                                    <xs:complexContent>
                                        <xs:extension base="docDef">
                                            <xs:attribute name="name" type="xs:string" />
                                        </xs:extension>
                                    </xs:complexContent>
                                </xs:complexType>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:complexType name="docDef">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:group ref="genericGroupDef" />
            <xs:element name="example" type="genericDef" minOccurs="0" maxOccurs="1" />
            <xs:element name="exception" type="crefGenericDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="include" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                    <xs:attribute name="uri" type="xs:string" />
                    <xs:attribute name="path" type="xs:string" />
                </xs:complexType>
            </xs:element>
            <xs:element name="param" type="namedGenericDef" minOccurs="0" maxOccurs="1" />
            <xs:element name="permission" type="crefGenericDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="remarks" type="genericDef" minOccurs="0" />
            <xs:element name="returns" type="genericDef" minOccurs="0" />
            <xs:element name="summary" type="genericDef" minOccurs="0" />
            <xs:element name="value" type="genericDef" minOccurs="0" />
        </xs:choice>
    </xs:complexType>
    <xs:complexType name="refDef">
        <xs:attribute name="cref" type="xs:string" use="required" />
        <xs:anyAttribute namespace="##other" processContents="lax" />
    </xs:complexType>
    <!-- Enable any well-formed XML element and undocumented elements -->
    <xs:group name="baseDef">
        <xs:choice>
            <xs:element name="subscript" minOccurs="0" maxOccurs="unbounded" >
                <xs:complexType>
                    <xs:attribute name="term" type="xs:string" />
                </xs:complexType>
            </xs:element>
            <xs:element name="superscript" minOccurs="0" maxOccurs="unbounded" >
                <xs:complexType>
                    <xs:attribute name="term" type="xs:string" />
                </xs:complexType>
            </xs:element>
            <xs:element name="note" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType mixed="true">
                    <xs:choice minOccurs="0" maxOccurs="unbounded">
                        <xs:group ref="genericGroupDef" />
                    </xs:choice>
                    <xs:attribute name="type" type="xs:string" />
                    <xs:anyAttribute namespace="##other" processContents="lax" />
                </xs:complexType>
            </xs:element>
            <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
        </xs:choice>
    </xs:group>
    <!-- This group is the base for all the others, as see and seealso elements are allowed everywhere -->
    <xs:group name="seeGroupDef">
        <xs:choice>
            <xs:group ref="baseDef" />        
            <xs:element name="see" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:attribute name="cref" type="xs:string" />
                    <!-- undocumented element -->
                    <xs:attribute name="langword" type="xs:string" />
                    <!-- undocumented element -->
                    <xs:attribute name="topic" type="xs:string" />
                    <!-- undocumented element -->
                    <xs:attribute name="title" type="xs:string" />
                    <!-- undocumented element -->
                    <xs:attribute name="qualify">
                        <xs:simpleType>
                            <xs:restriction base="xs:string">
                                <xs:enumeration value="true" />
                                <xs:enumeration value="false" />
                            </xs:restriction>
                        </xs:simpleType>
                    </xs:attribute>                    
                    <xs:anyAttribute namespace="##other" processContents="lax" />
                </xs:complexType>
            </xs:element>            
            <xs:element name="seealso" type="refDef" minOccurs="0" maxOccurs="unbounded" />
        </xs:choice>
    </xs:group>
    <xs:group name="genericGroupDef">
        <xs:choice>
            <xs:group ref="seeGroupDef" />
            <xs:element name="c" type="cDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="code" type="codeDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="list" type="listDef" minOccurs="0" maxOccurs="unbounded" />
            <!-- para element doesn't appear in Intellisense, but is found in mscorlib documentation -->
            <xs:element name="para" type="paraDef" minOccurs="0" maxOccurs="unbounded" />
            <!-- paramref element doesn't appear in Intellisense, but is found in .NET documentation -->
            <xs:element name="paramref" type="namedDef" minOccurs="0" maxOccurs="unbounded" />
        </xs:choice>
    </xs:group>
    <xs:complexType name="cDef" mixed="true">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:group ref="seeGroupDef" />
            <xs:element name="code" type="codeDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="list" type="listDef" minOccurs="0" maxOccurs="unbounded" />
        </xs:choice>
        <xs:anyAttribute namespace="##other" processContents="lax" />
    </xs:complexType>
    <xs:complexType name="codeDef" mixed="true">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:group ref="seeGroupDef" />
            <xs:element name="c" type="cDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="list" type="listDef" minOccurs="0" maxOccurs="unbounded" />
        </xs:choice>
        <xs:anyAttribute namespace="##other" processContents="lax" />
    </xs:complexType>
    <xs:complexType name="listDef" mixed="true">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:group ref="seeGroupDef" />
            <xs:element name="c" type="cDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="code" type="codeDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="description" type="descriptionDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="item" type="itemDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="listheader" type="headerDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="para" type="paraDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="term" type="termDef" minOccurs="0" maxOccurs="unbounded" />
        </xs:choice>
        <xs:attribute name="type" use="required">
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:enumeration value="bullet" />
                    <xs:enumeration value="number" />
                    <xs:enumeration value="table" />                    
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:anyAttribute namespace="##other" processContents="lax" />
    </xs:complexType>
    <xs:complexType name="descriptionDef" mixed="true">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:group ref="seeGroupDef" />
            <xs:element name="c" type="cDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="code" type="codeDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="item" type="itemDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="listheader" type="headerDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="para" type="paraDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="term" type="termDef" minOccurs="0" maxOccurs="unbounded" />
            <!-- paramref element doesn't appear in Intellisense, but is found in .NET documentation -->
            <xs:element name="paramref" type="namedDef" minOccurs="0" maxOccurs="unbounded" />
        </xs:choice>
        <xs:anyAttribute namespace="##other" processContents="lax" />
    </xs:complexType>
    <xs:complexType name="itemDef" mixed="true">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:group ref="seeGroupDef" />
            <xs:element name="c" type="cDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="code" type="codeDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="description" type="descriptionDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="listheader" type="headerDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="para" type="paraDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="term" type="termDef" minOccurs="0" maxOccurs="unbounded" />
        </xs:choice>
        <xs:anyAttribute namespace="##other" processContents="lax" />
    </xs:complexType>
    <xs:complexType name="headerDef" mixed="true">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:group ref="seeGroupDef" />
            <xs:element name="c" type="cDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="code" type="codeDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="description" type="descriptionDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="item" type="itemDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="para" type="paraDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="term" type="termDef" minOccurs="0" maxOccurs="unbounded" />
        </xs:choice>
        <xs:anyAttribute namespace="##other" processContents="lax" />
    </xs:complexType>
    <xs:complexType name="paraDef" mixed="true">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:group ref="seeGroupDef" />
            <xs:element name="c" type="cDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="code" type="codeDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="description" type="descriptionDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="item" type="itemDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="listheader" type="headerDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="term" type="termDef" minOccurs="0" maxOccurs="unbounded" />
            <!-- paramref element doesn't appear in Intellisense, but is found in .NET documentation -->
            <xs:element name="paramref" type="namedDef" minOccurs="0" maxOccurs="unbounded" />
        </xs:choice>
        <xs:anyAttribute namespace="##other" processContents="lax" />
    </xs:complexType>
    <xs:complexType name="termDef" mixed="true">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:group ref="seeGroupDef" />
            <xs:element name="c" type="cDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="code" type="codeDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="description" type="descriptionDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="item" type="itemDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="listheader" type="headerDef" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="para" type="paraDef" minOccurs="0" maxOccurs="unbounded" />
            <!-- paramref element doesn't appear in Intellisense, but is found in .NET documentation -->
            <xs:element name="paramref" type="namedDef" minOccurs="0" maxOccurs="unbounded" />
        </xs:choice>
        <xs:anyAttribute namespace="##other" processContents="lax" />
    </xs:complexType>
    <xs:complexType name="genericDef" mixed="true">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:group ref="genericGroupDef" />
        </xs:choice>
        <xs:anyAttribute namespace="##other" processContents="lax" />
    </xs:complexType>
    <xs:complexType name="namedGenericDef" mixed="true">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:group ref="genericGroupDef" />
        </xs:choice>
        <xs:attribute name="name" type="xs:string" use="required" />
        <xs:anyAttribute namespace="##other" processContents="lax" />
    </xs:complexType>
    <xs:complexType name="crefGenericDef" mixed="true">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:group ref="genericGroupDef" />
        </xs:choice>
        <xs:attribute name="cref" type="xs:string" use="required" />
        <xs:anyAttribute namespace="##other" processContents="lax" />
    </xs:complexType>
    <xs:complexType name="namedDef">
        <xs:attribute name="name" type="xs:string" use="required" />
        <xs:anyAttribute namespace="##other" processContents="lax" />
    </xs:complexType>
</xs:schema>