Appendix A. The XML Schema for the Bundle Descriptor

<?xml version="1.0" encoding="UTF-8"?>
<!--
 Copyright 2009-2010 Jeremias Maerki.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified"
    targetNamespace="http://www.jeremias-maerki.ch/ns/osgi-bundle"
    xmlns:bndl="http://www.jeremias-maerki.ch/ns/osgi-bundle">
  <xs:element name="bundle">
    <xs:complexType>
      <xs:all>
        <xs:element name="name" type="xs:string" minOccurs="0"/>
        <xs:element name="description" type="xs:string" minOccurs="0"/>
        <xs:element name="symbolic-name" type="xs:string" minOccurs="0"/>
        <xs:element name="category" type="xs:string" minOccurs="0"/>
        <xs:element ref="bndl:headers" minOccurs="0"/>
        <xs:element ref="bndl:exports" minOccurs="0"/>
        <xs:element ref="bndl:imports" minOccurs="0"/>
      </xs:all>
    </xs:complexType>
  </xs:element>
  <xs:element name="headers">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="bndl:header" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="header" type="bndl:name-value-pair-type"/>
  <xs:element name="exports">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="bndl:export"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="export">
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base="bndl:package-name-match-type">
          <xs:attribute name="version" type="bndl:simple-version" use="optional"/>
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>
  <xs:simpleType name="fragment-attachment-type">
    <xs:restriction base="xs:NCName">
      <xs:enumeration value="always"/>
      <xs:enumeration value="never"/>
      <xs:enumeration value="resolve-time"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="package-name-match-type">
    <xs:restriction base="xs:string">
      <xs:pattern value="([a-zA-Z0-9_\-\.\*])*"></xs:pattern>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="simple-version">
    <xs:restriction base="xs:string">
      <xs:pattern value="[0-9]([0-9\.])+"></xs:pattern>
    </xs:restriction>
  </xs:simpleType>
  <xs:element name="imports">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="bndl:import"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="import">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="bndl:directive" minOccurs="0" maxOccurs="unbounded"/>
        <xs:element ref="bndl:attribute" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
      <xs:attribute name="match" type="bndl:package-name-match-type" use="required"/>
      <xs:attribute name="add" type="xs:boolean" default="false"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="directive" type="bndl:name-value-pair-type"/>
  <xs:element name="attribute" type="bndl:name-value-pair-type"/>
  <xs:complexType name="name-value-pair-type">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute name="name" type="xs:NCName" use="required"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
</xs:schema>