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

<!-- This file contains the XML Schema Document (XSD) for the XML QoS
     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">

    <!-- ================================================================== -->
    <!-- Definition of simple types                                                         -->
    <!-- ================================================================== -->

    <xs:simpleType name="elementName">
        <xs:restriction base="xs:string">
            <xs:pattern value="[a-zA-Z0-9_.]+" />
            <xs:maxLength value="255"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="elementNameReference">
        <xs:restriction base="xs:string">
            <xs:pattern value="((::)?[a-zA-Z0-9_.])+" />
        </xs:restriction>
    </xs:simpleType>

    <!-- Similar to xs:hexBinary except optional whitespace -->
    <xs:simpleType name="hexBinaryWithWhitespace">
        <xs:restriction base="xs:string">
            <xs:pattern value="\s*([0-9a-fA-F]{2}(\s*[0-9a-fA-F]{2})*)?\s*"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="topicNameFilter">
        <xs:restriction base="xs:string">
            <xs:whiteSpace value="collapse"/>
            <xs:pattern value="[a-zA-Z0-9/\-_.:\s\*]+" />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="destinationOrderKind">
        <xs:restriction base="xs:string">
            <xs:whiteSpace value="collapse"/> 
            <xs:enumeration value="BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS" />
            <xs:enumeration value="BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS" />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="durabilityKind">
        <xs:restriction base="xs:string">
            <xs:whiteSpace value="collapse"/> 
            <xs:enumeration value="VOLATILE_DURABILITY_QOS" />
            <xs:enumeration value="TRANSIENT_LOCAL_DURABILITY_QOS" />
            <xs:enumeration value="TRANSIENT_DURABILITY_QOS" />
            <xs:enumeration value="PERSISTENT_DURABILITY_QOS" />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="historyKind">
        <xs:restriction base="xs:string">
            <xs:whiteSpace value="collapse"/> 
            <xs:enumeration value="KEEP_LAST_HISTORY_QOS" />
            <xs:enumeration value="KEEP_ALL_HISTORY_QOS" />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="livelinessKind">
        <xs:restriction base="xs:string">
            <xs:whiteSpace value="collapse"/> 
            <xs:enumeration value="AUTOMATIC_LIVELINESS_QOS" />
            <xs:enumeration value="MANUAL_BY_PARTICIPANT_LIVELINESS_QOS" />
            <xs:enumeration value="MANUAL_BY_TOPIC_LIVELINESS_QOS" />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="presentationAccessScopeKind">
        <xs:restriction base="xs:string">
            <xs:whiteSpace value="collapse"/> 
            <xs:enumeration value="INSTANCE_PRESENTATION_QOS" />
            <xs:enumeration value="TOPIC_PRESENTATION_QOS" />
            <xs:enumeration value="GROUP_PRESENTATION_QOS" />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="reliabilityKind">
        <xs:restriction base="xs:string">
            <xs:whiteSpace value="collapse"/> 
            <xs:enumeration value="BEST_EFFORT_RELIABILITY_QOS" />
            <xs:enumeration value="RELIABLE_RELIABILITY_QOS" />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ownershipKind">
        <xs:restriction base="xs:string">
            <xs:whiteSpace value="collapse"/> 
            <xs:enumeration value="SHARED_OWNERSHIP_QOS" />
            <xs:enumeration value="EXCLUSIVE_OWNERSHIP_QOS" />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="nonNegativeInteger_UNLIMITED">
        <xs:restriction base="xs:string">
            <xs:whiteSpace value="collapse"/> 
            <xs:pattern value="(LENGTH_UNLIMITED|([0-9])*)?"></xs:pattern>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="nonNegativeInteger_Duration_SEC">
        <xs:restriction base="xs:string">
            <xs:whiteSpace value="collapse"/> 
            <xs:pattern value="(DURATION_INFINITY|DURATION_INFINITE_SEC|([0-9])*)?" />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="nonNegativeInteger_Duration_NSEC">
        <xs:restriction base="xs:string">
            <xs:whiteSpace value="collapse"/> 
            <xs:pattern value="(DURATION_INFINITY|DURATION_INFINITE_NSEC|([0-9])*)?" />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="positiveInteger_UNLIMITED">
        <xs:restriction base="xs:string">
            <xs:whiteSpace value="collapse"/> 
            <xs:pattern value="(LENGTH_UNLIMITED|[1-9]([0-9])*)?" />
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="duration">
        <xs:all>
            <xs:element name="sec" type="nonNegativeInteger_Duration_SEC"
                minOccurs="0" />
            <xs:element name="nanosec" type="nonNegativeInteger_Duration_NSEC"
                minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <xs:complexType name="stringSeq">
        <xs:sequence>
            <xs:element name="element" type="xs:string" minOccurs="0"
                maxOccurs="unbounded" />
        </xs:sequence>
    </xs:complexType>

    <!-- RTF1 -->
    <xs:simpleType name="propertyName">
        <xs:restriction base="xs:string">
            <xs:whiteSpace value="collapse"/>
            <xs:pattern value="([a-zA-Z0-9_.:])+"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:complexType name="propertyValue">
        <xs:sequence>
            <xs:element name="name"
                        type="propertyName"
                        minOccurs="0"/>
            <xs:element name="value"
                        type="xs:string"
                        minOccurs="0"/>
            <xs:element name="propagate"
                        type="xs:boolean"
                        minOccurs="0">
            </xs:element>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="propertyValueSeq">
        <xs:sequence>
            <xs:element name="element"
                        type="propertyValue"
                        minOccurs="0"
                        maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>

    <!-- ================================================================== -->
    <!-- Qos Policy definitions -->
    <!-- ================================================================== -->

    <xs:complexType name="deadlineQosPolicy">
        <xs:all>
            <xs:element name="period" type="duration" minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <xs:complexType name="destinationOrderQosPolicy">
        <xs:all>
            <xs:element name="kind" type="destinationOrderKind"
                minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <xs:complexType name="durabilityQosPolicy">
        <xs:all>
            <xs:element name="kind" type="durabilityKind" default="VOLATILE_DURABILITY_QOS"
                minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <xs:complexType name="durabilityServiceQosPolicy">
        <xs:all>
            <xs:element name="service_cleanup_delay" type="duration"
                minOccurs="0" />
            <xs:element name="history_kind" type="historyKind"
                default="KEEP_LAST_HISTORY_QOS" minOccurs="0" />
            <xs:element name="history_depth" type="xs:positiveInteger"
                minOccurs="0" />
            <xs:element name="max_samples" type="positiveInteger_UNLIMITED"
                minOccurs="0" />
            <xs:element name="max_instances" type="positiveInteger_UNLIMITED"
                minOccurs="0" />
            <xs:element name="max_samples_per_instance" type="positiveInteger_UNLIMITED"
                minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <xs:complexType name="entityFactoryQosPolicy">
        <xs:all>
            <xs:element name="autoenable_created_entities" type="xs:boolean"
                default="true" minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <xs:complexType name="groupDataQosPolicy">
        <xs:all>
            <xs:element name="value" type="hexBinaryWithWhitespace"
                minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <xs:complexType name="historyQosPolicy">
        <xs:all>
            <xs:element name="kind" type="historyKind" default="KEEP_LAST_HISTORY_QOS"
                minOccurs="0" />
            <xs:element name="depth" type="xs:positiveInteger"
                default="1" minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <xs:complexType name="latencyBudgetQosPolicy">
        <xs:all>
            <xs:element name="duration" type="duration" minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <xs:complexType name="lifespanQosPolicy">
        <xs:all>
            <xs:element name="duration" type="duration" minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <xs:complexType name="livelinessQosPolicy">
        <xs:all>
            <xs:element name="kind" type="livelinessKind" default="AUTOMATIC_LIVELINESS_QOS"
                minOccurs="0" />
            <xs:element name="lease_duration" type="duration"
                minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <xs:complexType name="ownershipQosPolicy">
        <xs:all>
            <xs:element name="kind" type="ownershipKind" minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <xs:complexType name="ownershipStrengthQosPolicy">
        <xs:all>
            <xs:element name="value" type="xs:nonNegativeInteger"
                minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <xs:complexType name="partitionQosPolicy">
        <xs:all>
            <xs:element name="name" type="stringSeq" minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <xs:complexType name="presentationQosPolicy">
        <xs:all>
            <xs:element name="access_scope" type="presentationAccessScopeKind"
                default="INSTANCE_PRESENTATION_QOS" minOccurs="0" />
            <xs:element name="coherent_access" type="xs:boolean"
                default="false" minOccurs="0" />
            <xs:element name="ordered_access" type="xs:boolean"
                default="false" minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <xs:complexType name="readerDataLifecycleQosPolicy">
        <xs:all>
            <xs:element name="autopurge_nowriter_samples_delay" type="duration"
                minOccurs="0" />
            <xs:element name="autopurge_disposed_samples_delay" type="duration"
                minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <xs:complexType name="reliabilityQosPolicy">
        <xs:all>
            <xs:element name="kind" type="reliabilityKind" minOccurs="0" />
            <xs:element name="max_blocking_time" type="duration"
                minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <xs:complexType name="resourceLimitsQosPolicy">
        <xs:all>
            <xs:element name="max_samples" type="positiveInteger_UNLIMITED"
                minOccurs="0" />
            <xs:element name="max_instances" type="positiveInteger_UNLIMITED"
                minOccurs="0" />
            <xs:element name="max_samples_per_instance" type="positiveInteger_UNLIMITED"
                minOccurs="0" />
            <xs:element name="initial_samples" type="xs:positiveInteger"
                minOccurs="0" />
            <xs:element name="initial_instances" type="xs:positiveInteger"
                minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <xs:complexType name="timeBasedFilterQosPolicy">
        <xs:all>
            <xs:element name="minimum_separation" type="duration"
                minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <xs:complexType name="topicDataQosPolicy">
        <xs:all>
            <xs:element name="value" type="hexBinaryWithWhitespace"
                minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <xs:complexType name="transportPriorityQosPolicy">
        <xs:all>
            <xs:element name="value" type="xs:nonNegativeInteger"
                minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <!-- userDataQosPolicy uses hexBinary encoding:
        * Allowed characters are all letters: a-z, A-Z,  digits: 0-9
        * Each two chracters encodes 1 Byte
        * Threre must be an even number of characters
    -->
    <xs:complexType name="userDataQosPolicy">
        <xs:all>
            <xs:element name="value" type="hexBinaryWithWhitespace"
                minOccurs="0"></xs:element>
        </xs:all>
    </xs:complexType>

    <xs:complexType name="writerDataLifecycleQosPolicy">
        <xs:all>
            <xs:element name="autodispose_unregistered_instances"
                type="xs:boolean" default="true" minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <!-- RTF1 -->
    <xs:complexType name="propertyQosPolicy">
        <xs:sequence>
            <xs:element name="value" type="propertyValueSeq" minOccurs="0"/>
        </xs:sequence>

        <xs:attribute name="inherit" type="xs:boolean"/>
    </xs:complexType>

    <xs:complexType name="simplePropertyDecl">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="name" type="propertyName" use="required" />
                <xs:attribute name="propagate" type="xs:boolean" use="optional" />     
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

    <xs:complexType name="propertyList">
        <xs:sequence>
            <xs:element name="property" type="simplePropertyDecl" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>

        <xs:attribute name="inherit" type="xs:boolean"/>
    </xs:complexType>

    <xs:complexType name="simpleBinaryPropertyDecl">
        <xs:simpleContent>
            <xs:extension base="hexBinaryWithWhitespace">
                <xs:attribute name="name" type="propertyName" use="required" />
                <xs:attribute name="propagate" type="xs:boolean" use="optional" />     
            </xs:extension>
        </xs:simpleContent>   
    </xs:complexType>

    <xs:complexType name="simpleBinaryPropertyDeclOld">
        <xs:sequence>
            <xs:element name="value" type="hexBinaryWithWhitespace"/>
        </xs:sequence>
        <xs:attribute name="name" type="propertyName" use="required"/>
        <xs:attribute name="propagate" type="xs:boolean" use="optional" />     
    </xs:complexType>

    <xs:complexType name="binaryPropertyList">
        <xs:sequence>
            <xs:element name="binary_property" type="simpleBinaryPropertyDecl" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>

        <xs:attribute name="inherit" type="xs:boolean"/>
    </xs:complexType>

    <xs:simpleType name="dataRepresentationIdKind">
        <xs:restriction base="xs:string">
            <xs:whiteSpace value="collapse"/>
            <xs:enumeration value="AUTO_DATA_REPRESENTATION"/>
            <xs:enumeration value="XCDR_DATA_REPRESENTATION"/>
            <xs:enumeration value="XCDR2_DATA_REPRESENTATION"/>
            <xs:enumeration value="XML_DATA_REPRESENTATION"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="dataRepresentationIdSeq">
        <xs:sequence>
            <xs:element name="element"
                        type="dataRepresentationIdKind"
                        minOccurs="0"
                        maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="dataRepresentationQosPolicy">
        <xs:all>
            <xs:element name="value"
                        type="dataRepresentationIdSeq"
                        minOccurs="0"/>
        </xs:all>
    </xs:complexType>


    <xs:simpleType name="typeConsistencyKind">
        <xs:restriction base="xs:string">
            <xs:whiteSpace value="collapse"/>
            <xs:enumeration value="DISALLOW_TYPE_COERCION" />
            <xs:enumeration value="ALLOW_TYPE_COERCION" />
            <xs:enumeration value="AUTO_TYPE_COERCION" />
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="typeConsistencyEnforcementQosPolicy">
        <xs:all>
            <xs:element name="kind"
                        type="typeConsistencyKind"
                        minOccurs="0"/>
            <xs:element name="ignore_sequence_bounds"
                        type="xs:boolean"
                        minOccurs="0"/>
            <xs:element name="ignore_string_bounds"
                        type="xs:boolean"
                        minOccurs="0"/>
            <xs:element name="ignore_member_names"
                        type="xs:boolean"
                        minOccurs="0"/>
            <xs:element name="prevent_type_widening"
                        type="xs:boolean"
                        minOccurs="0"/>
            <xs:element name="force_type_validation"
                        type="xs:boolean"
                        minOccurs="0"/>
            <xs:element name="ignore_enum_literal_names"
                        type="xs:boolean"
                        minOccurs="0"/>
        </xs:all>
    </xs:complexType>

    <xs:complexType name="tagValue">
        <xs:sequence>
            <xs:element name="name" type="xs:string"/>
            <xs:element name="value" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="tagValueSeq">
        <xs:sequence>
            <xs:element name="element"  type="tagValue"
                        minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="dataTagQosPolicy">
        <xs:sequence>
            <xs:element name="tags" type="tagValueSeq"/>
        </xs:sequence>
        <xs:attribute name="inherit" type="xs:boolean"/>
    </xs:complexType>    

    <!-- ================================================================== -->
    <!-- Entity Qos definitions -->
    <!-- ================================================================== -->

    <xs:attributeGroup name="entityQosInlineAttributes">
        <xs:attribute name="name" type="elementName" />
        <xs:attribute name="base_name" type="elementNameReference" />
    </xs:attributeGroup>

    <xs:attributeGroup name="entityQosSnippetAttributes">
        <xs:attribute name="name" type="elementName" />
    </xs:attributeGroup>

    <xs:attributeGroup name="entityQosProfileAttributes">
        <xs:attribute name="name" type="elementName" use="required" />
        <xs:attribute name="base_name" type="elementNameReference" />
    </xs:attributeGroup>

    <xs:attributeGroup name="entityQosProfileElementAttributes">
        <xs:attribute name="name" type="elementName" />
        <xs:attribute name="base_name" type="elementNameReference" />
        <xs:attribute name="topic_filter" type="topicNameFilter" />
    </xs:attributeGroup>

    <xs:complexType name="domainparticipantQosCommon">
        <xs:all>
            <xs:element name="qos_snippets" type="appliedQosSnippetSeq"
                minOccurs="0" />
            <xs:element name="user_data" type="userDataQosPolicy"
                minOccurs="0" />
            <xs:element name="entity_factory" type="entityFactoryQosPolicy"
                minOccurs="0" />
            <!-- RTF1 -->
            <xs:element name="property" type="propertyQosPolicy"
                minOccurs="0" />
            <xs:element name="properties" type="propertyList"
                minOccurs="0" />
            <xs:element name="binary_properties" type="binaryPropertyList"
                minOccurs="0" />
            <xs:element name="partition" type="partitionQosPolicy"
                minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <xs:complexType name="domainparticipantQosInline">
        <xs:complexContent>
            <xs:extension base="domainparticipantQosCommon">
                <xs:attributeGroup ref="entityQosInlineAttributes" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="domainparticipantQosSnippet">
        <xs:complexContent>
            <xs:extension base="domainparticipantQosCommon">
                <xs:attributeGroup ref="entityQosSnippetAttributes" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="domainparticipantQosProfile">
        <xs:complexContent>
            <xs:extension base="domainparticipantQosCommon">
                <xs:attributeGroup ref="entityQosProfileAttributes" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="domainparticipantQosProfileElement">
        <xs:complexContent>
            <xs:extension base="domainparticipantQosCommon">
                <xs:attributeGroup ref="entityQosProfileElementAttributes" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="publisherQosCommon">
        <xs:all>
            <xs:element name="qos_snippets" type="appliedQosSnippetSeq"
                minOccurs="0" />
            <xs:element name="presentation" type="presentationQosPolicy"
                minOccurs="0" />
            <xs:element name="partition" type="partitionQosPolicy"
                minOccurs="0" />
            <xs:element name="group_data" type="groupDataQosPolicy"
                minOccurs="0" />
            <xs:element name="entity_factory" type="entityFactoryQosPolicy"
                minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <xs:complexType name="publisherQosInline">
        <xs:complexContent>
            <xs:extension base="publisherQosCommon">
                <xs:attributeGroup ref="entityQosInlineAttributes" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="publisherQosSnippet">
        <xs:complexContent>
            <xs:extension base="publisherQosCommon">
                <xs:attributeGroup ref="entityQosSnippetAttributes" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="publisherQosProfile">
        <xs:complexContent>
            <xs:extension base="publisherQosCommon">
                <xs:attributeGroup ref="entityQosProfileAttributes" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="publisherQosProfileElement">
        <xs:complexContent>
            <xs:extension base="publisherQosCommon">
                <xs:attributeGroup ref="entityQosProfileElementAttributes" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="subscriberQosCommon">
        <xs:all>
            <xs:element name="qos_snippets" type="appliedQosSnippetSeq"
                minOccurs="0" />
            <xs:element name="presentation" type="presentationQosPolicy"
                minOccurs="0" />
            <xs:element name="partition" type="partitionQosPolicy"
                minOccurs="0" />
            <xs:element name="group_data" type="groupDataQosPolicy"
                minOccurs="0" />
            <xs:element name="entity_factory" type="entityFactoryQosPolicy"
                minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <xs:complexType name="subscriberQosInline">
        <xs:complexContent>
            <xs:extension base="subscriberQosCommon">
                <xs:attributeGroup ref="entityQosInlineAttributes" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="subscriberQosSnippet">
        <xs:complexContent>
            <xs:extension base="subscriberQosCommon">
                <xs:attributeGroup ref="entityQosSnippetAttributes" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="subscriberQosProfile">
        <xs:complexContent>
            <xs:extension base="subscriberQosCommon">
                <xs:attributeGroup ref="entityQosProfileAttributes" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="subscriberQosProfileElement">
        <xs:complexContent>
            <xs:extension base="subscriberQosCommon">
                <xs:attributeGroup ref="entityQosProfileElementAttributes" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="topicQosCommon">
        <xs:all>
            <xs:element name="qos_snippets" type="appliedQosSnippetSeq"
                minOccurs="0" />
            <xs:element name="topic_data" type="topicDataQosPolicy"
                minOccurs="0" />
            <xs:element name="durability" type="durabilityQosPolicy"
                minOccurs="0" />
            <xs:element name="durability_service" type="durabilityServiceQosPolicy"
                minOccurs="0" />
            <xs:element name="deadline" type="deadlineQosPolicy"
                minOccurs="0" />
            <xs:element name="latency_budget" type="latencyBudgetQosPolicy"
                minOccurs="0" />
            <xs:element name="liveliness" type="livelinessQosPolicy"
                minOccurs="0" />
            <xs:element name="reliability" type="reliabilityQosPolicy"
                minOccurs="0" />
            <xs:element name="destination_order" type="destinationOrderQosPolicy"
                minOccurs="0" />
            <xs:element name="history" type="historyQosPolicy"
                minOccurs="0" />
            <xs:element name="resource_limits" type="resourceLimitsQosPolicy"
                minOccurs="0" />
            <xs:element name="transport_priority" type="transportPriorityQosPolicy"
                minOccurs="0" />
            <xs:element name="lifespan" type="lifespanQosPolicy"
                minOccurs="0" />
            <xs:element name="ownership" type="ownershipQosPolicy"
                minOccurs="0" />
            <!-- RTF1 -->
            <xs:element name="data_representation" type="dataRepresentationQosPolicy"
                minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <xs:complexType name="topicQosInline">
        <xs:complexContent>
            <xs:extension base="topicQosCommon">
                <xs:attributeGroup ref="entityQosInlineAttributes" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="topicQosSnippet">
        <xs:complexContent>
            <xs:extension base="topicQosCommon">
                <xs:attributeGroup ref="entityQosSnippetAttributes" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="topicQosProfile">
        <xs:complexContent>
            <xs:extension base="topicQosCommon">
                <xs:attributeGroup ref="entityQosProfileAttributes" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="topicQosProfileElement">
        <xs:complexContent>
            <xs:extension base="topicQosCommon">
                <xs:attributeGroup ref="entityQosProfileElementAttributes" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="datareaderQosCommon">
        <xs:all>
            <xs:element name="qos_snippets" type="appliedQosSnippetSeq"
                minOccurs="0" />
            <xs:element name="durability" type="durabilityQosPolicy"
                minOccurs="0" />
            <xs:element name="deadline" type="deadlineQosPolicy"
                minOccurs="0" />
            <xs:element name="latency_budget" type="latencyBudgetQosPolicy"
                minOccurs="0" />
            <xs:element name="liveliness" type="livelinessQosPolicy"
                minOccurs="0" />
            <xs:element name="reliability" type="reliabilityQosPolicy"
                minOccurs="0" />
            <xs:element name="destination_order" type="destinationOrderQosPolicy"
                minOccurs="0" />
            <xs:element name="history" type="historyQosPolicy"
                minOccurs="0" />
            <xs:element name="resource_limits" type="resourceLimitsQosPolicy"
                minOccurs="0" />
            <xs:element name="user_data" type="userDataQosPolicy"
                minOccurs="0" />
            <xs:element name="ownership" type="ownershipQosPolicy"
                minOccurs="0" />
            <xs:element name="time_based_filter" type="timeBasedFilterQosPolicy"
                minOccurs="0" />
            <xs:element name="reader_data_lifecycle" type="readerDataLifecycleQosPolicy"
                minOccurs="0" />
            <!-- RTF1 -->
            <xs:element name="data_tags"  type="dataTagQosPolicy"
                minOccurs="0" />  
            <xs:element name="data_representation" type="dataRepresentationQosPolicy"
                minOccurs="0" />
            <xs:element name="partition"  type="partitionQosPolicy"
                minOccurs="0" /> 
            <xs:element name="properties" type="propertyList"
                minOccurs="0" />
            <xs:element name="binary_properties" type="binaryPropertyList"
                minOccurs="0" />
            <xs:element name="property"   type="propertyQosPolicy"
                minOccurs="0" />
            <xs:element name="transport_priority"  type="transportPriorityQosPolicy"
                minOccurs="0" />
            <xs:element name="type_consistency"    type="typeConsistencyEnforcementQosPolicy"
                minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <xs:complexType name="datareaderQosInline">
        <xs:complexContent>
            <xs:extension base="datareaderQosCommon">
                <xs:attributeGroup ref="entityQosInlineAttributes" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="datareaderQosSnippet">
        <xs:complexContent>
            <xs:extension base="datareaderQosCommon">
                <xs:attributeGroup ref="entityQosSnippetAttributes" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="datareaderQosProfile">
        <xs:complexContent>
            <xs:extension base="datareaderQosCommon">
                <xs:attributeGroup ref="entityQosProfileAttributes" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="datareaderQosProfileElement">
        <xs:complexContent>
            <xs:extension base="datareaderQosCommon">
                <xs:attributeGroup ref="entityQosProfileElementAttributes" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    
    <xs:complexType name="datawriterQosCommon">
        <xs:all>
            <xs:element name="qos_snippets" type="appliedQosSnippetSeq"
                minOccurs="0" />
            <xs:element name="durability" type="durabilityQosPolicy"
                minOccurs="0" />
            <xs:element name="durability_service" type="durabilityServiceQosPolicy"
                minOccurs="0" />
            <xs:element name="deadline" type="deadlineQosPolicy"
                minOccurs="0" />
            <xs:element name="latency_budget" type="latencyBudgetQosPolicy"
                minOccurs="0" />
            <xs:element name="liveliness" type="livelinessQosPolicy"
                minOccurs="0" />
            <xs:element name="reliability" type="reliabilityQosPolicy"
                minOccurs="0" />
            <xs:element name="destination_order" type="destinationOrderQosPolicy"
                minOccurs="0" />
            <xs:element name="history" type="historyQosPolicy"
                minOccurs="0" />
            <xs:element name="resource_limits" type="resourceLimitsQosPolicy"
                minOccurs="0" />
            <xs:element name="ownership" type="ownershipQosPolicy"
                minOccurs="0" />
            <xs:element name="ownership_strength" type="ownershipStrengthQosPolicy"
                minOccurs="0" />
            <xs:element name="transport_priority" type="transportPriorityQosPolicy"
                minOccurs="0" />
            <xs:element name="lifespan" type="lifespanQosPolicy"
                minOccurs="0" />
            <xs:element name="user_data" type="userDataQosPolicy"
                minOccurs="0" />
            <xs:element name="writer_data_lifecycle" type="writerDataLifecycleQosPolicy"
                minOccurs="0" />
            <!-- RTF1 -->
            <xs:element name="data_representation" type="dataRepresentationQosPolicy"
                minOccurs="0" />
            <xs:element name="data_tags"           type="dataTagQosPolicy"
                minOccurs="0" />   
            <xs:element name="partition" type="partitionQosPolicy"
                minOccurs="0" />  
            <xs:element name="properties" type="propertyList"
                minOccurs="0" />
                <xs:element name="binary_properties" type="binaryPropertyList"
                minOccurs="0" />
            <xs:element name="property" type="propertyQosPolicy"
                minOccurs="0" />
            </xs:all>
    </xs:complexType>

    <xs:complexType name="datawriterQosInline">
        <xs:complexContent>
            <xs:extension base="datawriterQosCommon">
                <xs:attributeGroup ref="entityQosInlineAttributes" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="datawriterQosSnippet">
        <xs:complexContent>
            <xs:extension base="datawriterQosCommon">
                <xs:attributeGroup ref="entityQosSnippetAttributes" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="datawriterQosProfile">
        <xs:complexContent>
            <xs:extension base="datawriterQosCommon">
                <xs:attributeGroup ref="entityQosProfileAttributes" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="datawriterQosProfileElement">
        <xs:complexContent>
            <xs:extension base="datawriterQosCommon">
                <xs:attributeGroup ref="entityQosProfileElementAttributes" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="snippetRef">
        <xs:attribute name="snippet_ref" type="elementNameReference" use="required" />
    </xs:complexType>

    <xs:complexType name="appliedQosSnippetSeq">
        <xs:sequence>
            <xs:element name="snippet" type="snippetRef"
                        minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="qosSnippet">
        <xs:sequence>
            <xs:element name="qos_snippets" type="appliedQosSnippetSeq"
                minOccurs="0" maxOccurs="1" />
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:element name="datareader_qos" type="datareaderQosSnippet" />
                <xs:element name="datawriter_qos" type="datawriterQosSnippet" />
                <xs:element name="topic_qos" type="topicQosSnippet" />
                <xs:element name="domain_participant_qos" type="domainparticipantQosSnippet" />
                <xs:element name="publisher_qos" type="publisherQosSnippet" />
                <xs:element name="subscriber_qos" type="subscriberQosSnippet" />
            </xs:choice>
        </xs:sequence>

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

    <xs:complexType name="qosProfile">
        <xs:sequence>
            <xs:element name="qos_snippets" type="appliedQosSnippetSeq"
                minOccurs="0" maxOccurs="1" />
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:element name="datareader_qos" type="datareaderQosProfileElement" />
                <xs:element name="datawriter_qos" type="datawriterQosProfileElement" />
                <xs:element name="topic_qos" type="topicQosProfileElement" />
                <xs:element name="domain_participant_qos" type="domainparticipantQosProfileElement" />
                <xs:element name="publisher_qos" type="publisherQosProfileElement" />
                <xs:element name="subscriber_qos" type="subscriberQosProfileElement" />
            </xs:choice>
        </xs:sequence>

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

    <xs:complexType name="qosLibrary">
        <xs:sequence>
            <xs:choice minOccurs="1" maxOccurs="unbounded">
                <xs:element name="qos_snippet" type="qosSnippet" />
                <xs:element name="qos_profile" type="qosProfile" />
                <xs:element name="datareader_qos" type="datareaderQosProfile" />
                <xs:element name="datawriter_qos" type="datawriterQosProfile" />
                <xs:element name="topic_qos" type="topicQosProfile" />
                <xs:element name="domain_participant_qos" type="domainparticipantQosProfile"/>
                <xs:element name="publisher_qos" type="publisherQosProfile" />
                <xs:element name="subscriber_qos" type="subscriberQosProfile" />
            </xs:choice>
        </xs:sequence>

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

</xs:schema>
