<xs:schema
    targetNamespace='http://www.w3.org/2009/09/ws-mex'
    xmlns:tns='http://www.w3.org/2009/09/ws-mex'
    xmlns:wsa='http://www.w3.org/2005/08/addressing'
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    elementFormDefault='qualified'
    blockDefault='#all'>

  <xs:import
      namespace="http://www.w3.org/2005/08/addressing"
      schemaLocation="http://www.w3.org/2006/03/addressing/ws-addr.xsd"/>

  <!-- Get Metadata request -->
  <xs:element name='GetMetadata'>
    <xs:complexType>
      <xs:sequence>
        <xs:element ref='tns:Dialect' minOccurs='0' maxOccurs='unbounded'/>
        <xs:any namespace='##other' processContents='lax' minOccurs='0'
                maxOccurs='unbounded'/>
      </xs:sequence>
      <xs:anyAttribute namespace='##other' processContents='lax'/>
    </xs:complexType>
  </xs:element>

  <!-- Get Metadata response -->
  <xs:element name='GetMetadataResponse'>
    <xs:complexType>
      <xs:sequence>
        <xs:element ref='tns:Metadata'/>
        <xs:any namespace='##other' processContents='lax' minOccurs='0'
                maxOccurs='unbounded'/>
      </xs:sequence>
      <xs:anyAttribute namespace='##other' processContents='lax'/>
    </xs:complexType>
  </xs:element>

  <xs:element name='Dialect'>
    <xs:complexType>
      <xs:attribute name='URI' type='xs:anyURI' use='required'/>
      <xs:attribute name='Identifier' type='xs:anyURI'/>
      <xs:attribute name='Content' type='xs:anyURI'/>
      <xs:anyAttribute namespace='##other' processContents='lax'/>
    </xs:complexType>
  </xs:element>

  <!-- Metadata -->
  <xs:element name='Metadata'>
    <xs:complexType>
      <xs:sequence>
        <xs:element ref='tns:MetadataSection'
                    minOccurs='0'
                    maxOccurs='unbounded'/>
        <xs:any namespace='##other' processContents='lax'
                minOccurs='0'
                maxOccurs='unbounded'/>
      </xs:sequence>
      <xs:anyAttribute namespace='##other' processContents='lax'/>
    </xs:complexType>
  </xs:element>

  <xs:element name='MetadataSection'>
    <xs:complexType>
      <xs:choice>
        <xs:any namespace='##other' processContents='lax'/>
        <xs:element name='MetadataReference' type='wsa:EndpointReferenceType' />
        <xs:element ref='tns:Location'/>
      </xs:choice>
      <xs:attribute name='Dialect' type='xs:anyURI' use='required'/>
      <xs:attribute name='Identifier' type='xs:anyURI'/>
      <xs:anyAttribute namespace='##other' processContents='lax'/>
    </xs:complexType>
  </xs:element>

  <xs:element name='Location' type='xs:anyURI'/>
</xs:schema>
