<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

    <xsd:simpleType name="ClassType">
        <xsd:restriction base="xsd:string">
            <xsd:pattern value="[A-Za-z_][A-Za-z0-9_]*(.[A-Za-z_][A-Za-z0-9_]*)*"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="IdentifierType">
        <xsd:restriction base="xsd:string">
            <xsd:pattern value="[A-Za-z0-9_]*"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="PluginType">
        <xsd:sequence>
            <xsd:element name="ShortDescription" type="xsd:string" />
            <xsd:element name="Details" type="xsd:string" />
            <xsd:element name="BugsUrl" type="xsd:string" maxOccurs="1" minOccurs="0"></xsd:element>
            <xsd:element name="AllBugsUrl" type="xsd:string" maxOccurs="1" minOccurs="0"></xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="PluginComponentType">
        <xsd:sequence>
            <xsd:element name="Description" type="xsd:string"  minOccurs="1" maxOccurs="1"/>
            <xsd:element name="Details" type="xsd:string"  minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
        <xsd:attribute name="id" type="ClassType"/>
    </xsd:complexType>

    <xsd:complexType name="FindBugsMainType">
        <xsd:sequence>
            <xsd:element name="Description" type="xsd:string"  minOccurs="1" maxOccurs="1"/>
        </xsd:sequence>
        <xsd:attribute name="cmd" type="xsd:string"/>
        <xsd:attribute name="class" type="ClassType"/>
    </xsd:complexType>
    
    <xsd:complexType name="CloudType">
        <xsd:sequence>
            <xsd:element name="Description" type="xsd:string"  minOccurs="1" maxOccurs="1"/>
            <xsd:element name="Details" type="xsd:string"  minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
        <xsd:attribute name="id" type="ClassType"/>
    </xsd:complexType>


    <xsd:complexType name="DetectorType">
        <xsd:sequence>
            <xsd:element name="Details" type="xsd:string"/>
        </xsd:sequence>
        <xsd:attribute name="class" type="ClassType"/>
    </xsd:complexType>

    <xsd:complexType name="BugCategoryType">
        <xsd:sequence>
            <xsd:element name="Description" type="xsd:string"/>
            <xsd:element name="Abbreviation" type="xsd:NMTOKEN"/> <!--typically a single capital letter-->
            <xsd:element name="Details" type="xsd:string" minOccurs="0"/>
        </xsd:sequence>
        <xsd:attribute name="category" type="IdentifierType"/>
    </xsd:complexType>

    <xsd:complexType name="BugPatternType">
        <xsd:sequence>
            <xsd:element name="ShortDescription" type="xsd:string"/>
            <xsd:element name="LongDescription" type="xsd:string"/>
            <xsd:element name="Details" type="xsd:string"/>
        </xsd:sequence>
        <xsd:attribute name="type" type="IdentifierType"/>
        <xsd:attribute name="deprecated" type="xsd:boolean" use="optional"/>
    </xsd:complexType>

    <xsd:complexType name="BugCodeType" mixed="true">
        <xsd:attribute name="abbrev" type="xsd:ID"/>
    </xsd:complexType>

    <xsd:complexType name="MessageCollectionType" mixed="true">
        <xsd:sequence>
            <xsd:element name="Plugin" type="PluginType"/>
            <xsd:element name="FindBugsMain" type="FindBugsMainType" minOccurs="0" maxOccurs="unbounded"/>
            <xsd:element name="Cloud" type="CloudType" minOccurs="0" maxOccurs="unbounded"/>
            <xsd:element name="PluginComponent" type="PluginComponentType" minOccurs="0" maxOccurs="unbounded"/>
            <xsd:element name="BugCategory" type="BugCategoryType" minOccurs="0" maxOccurs="unbounded"/>
            <xsd:element name="Detector" type="DetectorType" minOccurs="1" maxOccurs="unbounded"/>
            <xsd:element name="BugPattern" type="BugPatternType" minOccurs="1" maxOccurs="unbounded"/>
            <xsd:element name="BugCode" type="BugCodeType" minOccurs="1" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:element name="MessageCollection" type="MessageCollectionType"/>

</xsd:schema>
