<?xml version="1.0" encoding="UTF-8"?>

<!-- This file contains the XML Schema Document (XSD) for the XML Domains
     Representation defined by the OMG specification "DDS Consolidated XML
     Syntax" (DDS-XML). -->

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           elementFormDefault="qualified"
           attributeFormDefault="unqualified">

    <!-- ================================================================== -->
    <!-- Inclusion of other Building Blocks -->
    <!-- ================================================================== -->

    <xs:include schemaLocation="http://www.omg.org/spec/DDS-XML/20180501/dds-xml_type_definitions_nonamespace.xsd" />
    <xs:include schemaLocation="http://www.omg.org/spec/DDS-XML/20180501/dds-xml_qos_definitions_nonamespace.xsd" />


    <!-- ================================================================== -->
    <!-- Domain Definition -->
    <!-- ================================================================== -->

    <!-- Register Type -->

    <xs:complexType name="registerType">
        <xs:choice minOccurs="0" maxOccurs="2">
            <xs:element name="registered_name" minOccurs="0"
                        type="elementName" />
        </xs:choice>

        <xs:attribute name="name" type="elementName" use="required" />
        <xs:attribute name="type_ref" type="elementNameReference"
                      use="optional" />
        <xs:attribute name="format" type="xs:string" use="optional" />
    </xs:complexType>

    <!-- Topic -->

    <xs:complexType name="topic">
        <xs:sequence minOccurs="0" maxOccurs="2">
            <xs:element name="registered_name" minOccurs="0"
                        type="elementName" />
            <xs:element name="topic_qos" type="topicQos" minOccurs="0" />
        </xs:sequence>

        <xs:attribute name="name" type="elementName" use="required" />
        <xs:attribute name="register_type_ref" type="elementNameReference"
                      use="required" />
    </xs:complexType>

    <!-- Domain -->

    <xs:complexType name="domain">
        <xs:choice minOccurs="1" maxOccurs="unbounded">
            <xs:element name="register_type" type="registerType" />
            <xs:element name="topic" type="topic" />
        </xs:choice>

        <xs:attribute name="name" type="xs:string" use="required" />
        <xs:attribute name="domain_id" type="xs:nonNegativeInteger" />
    </xs:complexType>


    <!-- ================================================================== -->
    <!-- Domain Library Definitions -->
    <!-- ================================================================== -->

    <xs:complexType name="domainLibrary">
        <xs:choice minOccurs="1" maxOccurs="unbounded">
            <xs:element name="domain" type="domain" minOccurs="1" />
        </xs:choice>

        <xs:attribute name="name" type="xs:string" use="required" />
    </xs:complexType>

</xs:schema>
