<?xml version="1.0" encoding="UTF-8"?>
<schema
        xmlns="http://www.w3.org/2001/XMLSchema"
        xmlns:tns="http://pmd.sourceforge.net/rule-tests"
        targetNamespace="http://pmd.sourceforge.net/rule-tests"
        elementFormDefault="qualified">

    <element name="test-data">
        <complexType>
            <choice maxOccurs="unbounded">
                <element name="test-code" minOccurs="0" maxOccurs="unbounded" type="tns:testType"/>
                <element name="code-fragment" minOccurs="0" maxOccurs="unbounded" type="tns:codeFragmentType">
                    <annotation>
                        <documentation>
                            A code fragment that can be referred to by several tests.
                        </documentation>
                    </annotation>
                </element>
            </choice>
        </complexType>
    </element>

    <complexType name="testType">
        <sequence>
            <element name="description" type="string"/>
            <element name="rule-property" minOccurs="0" maxOccurs="unbounded">
                <complexType>
                    <simpleContent>
                        <extension base="string">
                            <attribute name="name" type="string" use="required"/>
                        </extension>
                    </simpleContent>
                </complexType>
            </element>

            <element name="expected-problems" type="nonNegativeInteger"/>
            <element name="expected-linenumbers" type="string" minOccurs="0"/>
            <element name="expected-messages" minOccurs="0">
                <complexType>
                    <sequence>
                        <element name="message" type="string" maxOccurs="unbounded"/>
                    </sequence>
                </complexType>
            </element>
            <choice>
                <element name="code" type="string"/>
                <element name="code-ref">
                    <complexType>
                        <attribute name="id" type="IDREF" use="required"/>
                    </complexType>
                </element>
            </choice>
            <element name="source-type" minOccurs="0" default="" type="string">
                <annotation>
                    <documentation>
                        Language version of the source, eg 'java 8'.
                    </documentation>
                </annotation>
            </element>
        </sequence>
        <attribute name="reinitializeRule" type="boolean" default="true">
            <annotation>
                <documentation>
                    This attribute is deprecated, it is assumed true and ignored.
                </documentation>
            </annotation>
        </attribute>
        <attribute name="regressionTest" type="boolean" default="true">
            <annotation>
                <documentation>
                    This attribute is deprecated. Use "disabled" instead.
                    If this attribute is set to "false", then the test is ignored.
                </documentation>
            </annotation>
        </attribute>
        <attribute name="useAuxClasspath" type="boolean" default="true">
            <annotation>
                <documentation>
                    This attribute is deprecated, it is assumed true and ignored.
                </documentation>
            </annotation>
        </attribute>

        <attribute name="disabled" type="boolean" default="false">
            <annotation>
                <documentation>
                    A reason why the test is disabled/ignored should be provided as a comment for the test.
                </documentation>
            </annotation>
        </attribute>
        <attribute name="focused" type="boolean" default="false">
            <annotation>
                <documentation>
                    If true, only this test will be executed, and all others will be disabled.
                    If several tests in the same file are focused, then the last one wins, in
                    document order.
                    This attribute is provided as a way for developers to temporarily focus on a single test.
                    Test files with a focused test should not be checked in. For this reason,
                    using this attribute produces a warning.
                </documentation>
            </annotation>
        </attribute>
    </complexType>

    <complexType name="codeFragmentType">
        <simpleContent>
            <extension base="string">
                <attribute name="id" type="ID" use="required"/>
            </extension>
        </simpleContent>
    </complexType>

</schema>
