<?xml version='1.0' encoding='UTF-8'?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    targetNamespace="http://www.xmlmind.com/xmleditor/schema/bugreport"
    xmlns="http://www.xmlmind.com/xmleditor/schema/bugreport" 
    xmlns:bug="http://www.xmlmind.com/xmleditor/schema/bugreport" 
    xmlns:htm="http://www.xmlmind.com/xmleditor/schema/xhtml" 
    elementFormDefault="qualified">

<xs:import namespace="http://www.xmlmind.com/xmleditor/schema/xhtml"
    schemaLocation="xhtml.xsd"/>

<xs:element name="bugReports" >
  <xs:complexType>
    <xs:sequence>
      <xs:element name="bugReport" type="BugReport" 
                  minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>

  <xs:unique name="Bug1">
    <xs:selector xpath="bug:bugReport" />
    <xs:field xpath="@id" />
  </xs:unique>
</xs:element>

<xs:complexType name="BugReport" >
  <xs:sequence>

    <xs:element name="program">
      <xs:simpleType>
        <xs:restriction base="xs:NMTOKEN">
          <xs:enumeration value="xxe" />
          <xs:enumeration value="xsdvalid" />
          <xs:enumeration value="xfc" />
        </xs:restriction>
      </xs:simpleType>
    </xs:element>

    <xs:element name="version">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:pattern value="(M|V)\d+\.\d+(p\d+)?" />
        </xs:restriction>
      </xs:simpleType>
    </xs:element>

    <xs:element name="submittedBy" type="Email" />

    <xs:element name="date" type="xs:dateTime" />

    <xs:element name="description" type="HTML" />

    <xs:element name="assignedTo" minOccurs="0">
      <xs:simpleType>
        <xs:restriction base="xs:NMTOKEN">
          <xs:enumeration value="hs" />
          <xs:enumeration value="jyb" />
          <xs:enumeration value="oi" />
        </xs:restriction>
      </xs:simpleType>
    </xs:element>

    <xs:element name="workaround" type="HTML" minOccurs="0" />

  </xs:sequence>

  <xs:attribute name="id" type="xs:positiveInteger" />
</xs:complexType>

<xs:simpleType name="Email">
  <xs:restriction base="xs:token">
    <xs:pattern value="[^\s@]+@\S+" />
  </xs:restriction>
</xs:simpleType>

<xs:complexType name="HTML" >
  <xs:sequence>
    <xs:any namespace="http://www.xmlmind.com/xmleditor/schema/xhtml" 
            processContents="strict" />
  </xs:sequence>
</xs:complexType>

</xs:schema>
