<?xml version="1.0" encoding="UTF-8"?>
<!--
 Copyright (c) 2000-2025 Ericsson Telecom AB
 All rights reserved. This program and the accompanying materials
 are made available under the terms of the Eclipse Public License v2.0
 which accompanies this distribution, and is available at
 https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html

 Contributors:
  Baranyi, Botond
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="www.example.org/bug537922" xmlns:ns1="www.example.org/bug537922">

  <xs:element name="mapping">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="unbounded" ref="ns1:displayName"/>
        <xs:group ref="ns1:serviceGroup"/>
        <xs:choice minOccurs="0">
          <xs:group ref="ns1:serviceBoundary"/>
          <xs:element ref="ns1:serviceBoundaryReference"/>
        </xs:choice>
        <xs:element minOccurs="0" maxOccurs="unbounded" ref="ns1:uri"/>
        <xs:element minOccurs="0" ref="ns1:serviceNumber"/>
        <xs:group ref="ns1:extensionPoint"/>
      </xs:sequence>
      <xs:attributeGroup ref="ns1:expires"/>
      <xs:attribute name="lastUpdated" use="required" type="xs:dateTime"/>
      <xs:attributeGroup ref="ns1:source"/>
      <xs:attribute name="sourceId" use="required" type="xs:token"/>
      <xs:attributeGroup ref="ns1:message"/>
    </xs:complexType>
  </xs:element>

  <xs:element name="displayName">
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base="xs:string">
          <xs:attribute ref="xs:integer" use="required"/>
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>
  
  <xs:group name="serviceGroup">
    <xs:sequence>
      <xs:element minOccurs="0" ref="ns1:service"/>
    </xs:sequence>
  </xs:group>
  
  <xs:element name="service" type="xs:anyURI"/>
  
  <xs:group name="serviceBoundary">
    <xs:sequence>
      <xs:element maxOccurs="unbounded" ref="ns1:serviceBoundary"/>
    </xs:sequence>
  </xs:group>
  
  <xs:element name="serviceBoundary" type="ns1:locationInformation"/>
  
  <xs:complexType name="locationInformation">
    <xs:group maxOccurs="unbounded" ref="ns1:extensionPoint"/>
    <xs:attribute name="profile" type="xs:NMTOKEN"/>
  </xs:complexType>
  
  <xs:group name="extensionPoint">
    <xs:annotation>
      <xs:documentation>
  A point where future extensions
  (elements from other namespaces)
  can be added.
</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:group minOccurs="0" maxOccurs="unbounded" ref="ns1:notLost"/>
    </xs:sequence>
  </xs:group>
  
  <xs:group name="notLost">
    <xs:annotation>
      <xs:documentation>
  Any element not in the LoST namespace.
</xs:documentation>
    </xs:annotation>
    <xs:choice>
      <xs:any namespace="##local" processContents="skip"/>
    </xs:choice>
  </xs:group>
  
  <xs:element name="serviceBoundaryReference">
    <xs:complexType>
      <xs:group ref="ns1:extensionPoint"/>
      <xs:attributeGroup ref="ns1:source"/>
      <xs:attributeGroup ref="ns1:serviceBoundaryKey"/>
    </xs:complexType>
  </xs:element>
  
  <xs:attributeGroup name="source">
    <xs:attribute name="source" use="required" type="ns1:appUniqueString"/>
  </xs:attributeGroup>
  
  <xs:simpleType name="appUniqueString">
    <xs:restriction base="xs:token">
      <xs:pattern value="([a-zA-Z0-9\-]+\.)+[a-zA-Z0-9]+"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:attributeGroup name="serviceBoundaryKey">
    <xs:attribute name="key" use="required" type="xs:token"/>
  </xs:attributeGroup>
  
  <xs:element name="uri" type="xs:anyURI"/>
  
  <xs:element name="serviceNumber">
    <xs:simpleType>
      <xs:restriction base="xs:token">
        <xs:pattern value="[0-9*#]+"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>
  
  <xs:attributeGroup name="expires">
    <xs:attribute name="expires" use="required">
    </xs:attribute>
  </xs:attributeGroup>
  
  <xs:attributeGroup name="message">
    <xs:attribute name="message" type="xs:token"/>
    <xs:attribute ref="xs:integer"/>
  </xs:attributeGroup>
  
</xs:schema>
