<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="2">
    <xs:annotation>
        <xs:documentation xml:lang="en">
            = Robot Framework output.xml schema =

            Compatible with Robot Framework 4.0 and newer. For more details see:
            https://github.com/robotframework/robotframework/tree/master/doc/schema

            Due to XSD 1.1 not being widely adopted, this schema is XSD 1.0 compatible.
            If you can use XSD 1.1, you can replace `xs:choice` groups with `xs:all`
            groups to make the schema more strict.
        </xs:documentation>
    </xs:annotation>
    <xs:element name="robot" type="Robot" />
    <xs:complexType name="Robot">
        <xs:sequence>
            <!-- Executed suite structure. -->
            <xs:element name="suite" type="Suite" />
            <!-- Execution statistics. Not read by Robot Framework itself. -->
            <xs:element name="statistics" type="Statistics" minOccurs="0" />
            <!-- Possible execution errors and warnings. -->
            <xs:element name="errors" type="Errors" minOccurs="0" />
        </xs:sequence>
        <xs:attribute name="generator" type="xs:string" />
        <xs:attribute name="generated" type="xs:string" />
        <!-- True when executing tasks, false (default) when executing tests. -->
        <xs:attribute name="rpa" type="xs:boolean" />
        <!-- Version of the schema output.xml is compatible with. Must match
             the `version` attribute of the `xs:schema` root element. -->
        <xs:attribute name="schemaversion" type="SpecVersion" />
    </xs:complexType>
    <xs:simpleType name="SpecVersion">
        <xs:restriction base="xs:integer">
            <xs:minInclusive value="2" />
            <xs:maxInclusive value="2" />
        </xs:restriction>
    </xs:simpleType>
    <xs:complexType name="Suite">
        <xs:choice maxOccurs="unbounded">
            <!-- These keywords are possible suite setup and teardown.
                 They must have the `type` attribute set accordingly. -->
            <xs:element name="kw" type="Keyword" minOccurs="0" maxOccurs="2" />
            <xs:element name="suite" type="Suite" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="test" type="Test" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="doc" type="xs:string" minOccurs="0" />
            <xs:element name="meta" type="Metadata" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="status" type="Status" />
        </xs:choice>
        <xs:attribute name="name" type="xs:string" />
        <xs:attribute name="source" type="xs:string" />
        <xs:attribute name="id" type="xs:string" />
    </xs:complexType>
    <xs:complexType name="Metadata">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="name" type="xs:string" use="required" />
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>
    <xs:complexType name="Test">
        <xs:choice maxOccurs="unbounded">
            <xs:element name="kw" type="Keyword" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="for" type="For" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="if" type="If" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="msg" type="Message" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="doc" type="xs:string" minOccurs="0" />
            <xs:element name="tag" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="timeout" type="Timeout" minOccurs="0" />
            <xs:element name="status" type="Status" />
        </xs:choice>
        <xs:attribute name="name" type="xs:string" />
        <xs:attribute name="id" type="xs:string" />
    </xs:complexType>
    <!-- Keywords can be regular keywords or setup and teardown keywords.
         If the later, they must have the `type` attribute set accordingly. -->
    <xs:complexType name="Keyword">
        <xs:choice maxOccurs="unbounded">
            <xs:element name="kw" type="Keyword" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="for" type="For" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="if" type="If" minOccurs="0" maxOccurs="unbounded" />
            <!-- Assigned variables. -->
            <xs:element name="var" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
            <!-- Arguments -->
            <xs:element name="arg" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="doc" type="xs:string" minOccurs="0" />
            <xs:element name="msg" type="Message" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="tag" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="timeout" type="Timeout" minOccurs="0" />
            <xs:element name="status" type="BodyItemStatus" />
        </xs:choice>
        <xs:attribute name="name" type="xs:string" />
        <xs:attribute name="library" type="xs:string" />
        <!-- Original name of the keyword when using embedded arguments, not used otherwise. -->
        <xs:attribute name="sourcename" type="xs:string" />
        <!-- Type is used only with setup and teardown. -->
        <xs:attribute name="type" type="KeywordType" />
    </xs:complexType>
    <xs:simpleType name="KeywordType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="SETUP" />
            <xs:enumeration value="TEARDOWN" />
        </xs:restriction>
    </xs:simpleType>
    <xs:complexType name="For">
        <xs:choice maxOccurs="unbounded">
            <!-- Loop variables. -->
            <xs:element name="var" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
            <!-- Loop values. -->
            <xs:element name="value" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
            <!-- Individual loop iterations. -->
            <xs:element name="iter" type="ForIteration" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="msg" type="Message" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="doc" type="xs:string" minOccurs="0" />
            <xs:element name="status" type="BodyItemStatus" />
        </xs:choice>
        <xs:attribute name="flavor" type="ForFlavor" />
    </xs:complexType>
    <xs:simpleType name="ForFlavor">
        <xs:restriction base="xs:string">
            <xs:enumeration value="IN" />
            <xs:enumeration value="IN RANGE" />
            <xs:enumeration value="IN ENUMERATE" />
            <xs:enumeration value="IN ZIP" />
        </xs:restriction>
    </xs:simpleType>
    <xs:complexType name="ForIteration">
        <xs:choice maxOccurs="unbounded">
            <!-- Loop variables with iteration specific values. -->
            <xs:element name="var" type="ForIterationVariable" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="kw" type="Keyword" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="for" type="For" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="if" type="If" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="msg" type="Message" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="doc" type="xs:string" minOccurs="0" />
            <xs:element name="status" type="BodyItemStatus" />
        </xs:choice>
    </xs:complexType>
    <xs:complexType name="ForIterationVariable">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="name" type="xs:string" use="required" />
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>
    <xs:complexType name="If">
        <xs:choice maxOccurs="unbounded">
            <!-- IF/ELSE branches. -->
            <xs:element name="branch" type="IfBranch" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="msg" type="Message" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="doc" type="xs:string" minOccurs="0" />
            <xs:element name="status" type="BodyItemStatus" />
        </xs:choice>
    </xs:complexType>
    <xs:complexType name="IfBranch">
        <xs:choice maxOccurs="unbounded">
            <xs:element name="kw" type="Keyword" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="for" type="For" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="if" type="If" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="msg" type="Message" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="doc" type="xs:string" minOccurs="0" />
            <xs:element name="status" type="BodyItemStatus" />
        </xs:choice>
        <xs:attribute name="type" type="IfType" use="required" />
        <xs:attribute name="condition" type="xs:string" />
    </xs:complexType>
    <xs:simpleType name="IfType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="IF" />
            <xs:enumeration value="ELSE IF" />
            <xs:enumeration value="ELSE" />
        </xs:restriction>
    </xs:simpleType>
    <xs:complexType name="Message">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="timestamp" type="xs:string" use="required" />
                <xs:attribute name="level" type="MessageLevel" use="required" />
                <xs:attribute name="html" type="xs:boolean" />
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>
    <xs:simpleType name="MessageLevel">
        <xs:restriction base="xs:string">
            <xs:enumeration value="TRACE" />
            <xs:enumeration value="DEBUG" />
            <xs:enumeration value="INFO" />
            <xs:enumeration value="WARN" />
            <xs:enumeration value="ERROR" />
            <xs:enumeration value="FAIL" />
            <xs:enumeration value="SKIP" />
        </xs:restriction>
    </xs:simpleType>
    <xs:complexType name="Status">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="status" type="StatusValue" use="required" />
                <xs:attribute name="starttime" type="xs:string" />
                <xs:attribute name="endtime" type="xs:string" />
                <!-- Not set if both `starttime` and `endtime` are defined. -->
                <xs:attribute name="elapsedtime" type="xs:string" />
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>
    <xs:simpleType name="StatusValue">
        <xs:restriction base="xs:string">
            <xs:enumeration value="PASS" />
            <xs:enumeration value="FAIL" />
            <xs:enumeration value="SKIP" />
        </xs:restriction>
    </xs:simpleType>
    <xs:complexType name="BodyItemStatus">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="status" type="BodyItemStatusValue" use="required" />
                <xs:attribute name="starttime" type="xs:string" />
                <xs:attribute name="endtime" type="xs:string" />
                <!-- Not set if both `starttime` and `endtime` are defined. -->
                <xs:attribute name="elapsedtime" type="xs:string" />
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>
    <xs:simpleType name="BodyItemStatusValue">
        <xs:restriction base="xs:string">
            <xs:enumeration value="PASS" />
            <xs:enumeration value="FAIL" />
            <xs:enumeration value="SKIP" />
            <xs:enumeration value="NOT RUN" />
        </xs:restriction>
    </xs:simpleType>
    <xs:complexType name="Timeout">
        <xs:attribute name="value" type="xs:string" use="required" />
    </xs:complexType>
    <xs:complexType name="Statistics">
        <xs:all>
            <xs:element name="total" type="TotalStatistics" />
            <xs:element name="tag" type="TagStatistics" />
            <xs:element name="suite" type="SuiteStatistics" />
        </xs:all>
    </xs:complexType>
    <xs:complexType name="TotalStatistics">
        <xs:sequence>
            <xs:element name="stat" type="TotalStat" />
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="TagStatistics">
        <xs:sequence>
            <xs:element name="stat" type="TagStat" minOccurs="0" maxOccurs="unbounded" />
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="SuiteStatistics">
        <xs:sequence>
            <xs:element name="stat" type="SuiteStat" maxOccurs="unbounded" />
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="TotalStat">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="pass" type="xs:integer" />
                <xs:attribute name="fail" type="xs:integer" />
                <xs:attribute name="skip" type="xs:integer" />
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>
    <xs:complexType name="TagStat">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="pass" type="xs:integer" />
                <xs:attribute name="fail" type="xs:integer" />
                <xs:attribute name="skip" type="xs:integer" />
                <xs:attribute name="doc" type="xs:string" />
                <xs:attribute name="links" type="xs:string" />
                <xs:attribute name="info" type="xs:string" />
                <xs:attribute name="combined" type="xs:string" />
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>
    <xs:complexType name="SuiteStat">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="pass" type="xs:integer" />
                <xs:attribute name="fail" type="xs:integer" />
                <xs:attribute name="skip" type="xs:integer" />
                <xs:attribute name="id" type="xs:string" />
                <xs:attribute name="name" type="xs:string" />
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>
    <xs:complexType name="Errors">
        <xs:sequence>
            <xs:element name="msg" type="Message" minOccurs="0" maxOccurs="unbounded" />
        </xs:sequence>
    </xs:complexType>
</xs:schema>
