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

<schema targetNamespace="http://xmlns.krupczak.org/xsd/xmp-1.0"
   xmlns="http://www.w3.org/2001/XMLSchema"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:typ="http://xmlns.krupczak.org/xsd/xmptypes-1.0"
   xmlns:xmp="http://xmlns.krupczak.org/xsd/xmp-1.0"
   elementFormDefault="qualified" attributeFormDefault="unqualified">

 <annotation>
   <documentation>XML Schema for XMP protocol.  
    Version $Id$
   </documentation>
 </annotation>

 <import namespace="http://xmlns.krupczak.org/xsd/xmptypes-1.0" 
         schemaLocation="http://xmlns.krupczak.org/xsd/xmptypes-1.0.xsd"/>

 <element name="xmp">
   <annotation>
     <documentation>Top-level element for XMP PDU</documentation>
   </annotation>
   <complexType>
      <choice minOccurs="1" maxOccurs="1">
       <element ref="xmp:GetRequest" minOccurs="1" maxOccurs="1"/>
       <element ref="xmp:SetRequest" minOccurs="1" maxOccurs="1"/>
       <element ref="xmp:SelectTableRequest" minOccurs="1" maxOccurs="1"/>
       <element ref="xmp:InsertTableRequest" minOccurs="1" maxOccurs="1"/>
       <element ref="xmp:DeleteTableRequest" minOccurs="1" maxOccurs="1"/>
       <element ref="xmp:UpdateTableRequest" minOccurs="1" maxOccurs="1"/>
       <element ref="xmp:Trap" minOccurs="1" maxOccurs="1"/>
       <element ref="xmp:Information" minOccurs="1" maxOccurs="1"/>
       <element ref="xmp:Response" minOccurs="1" maxOccurs="1"/>
      </choice>
      <attribute name="message-id" type="unsignedInt" use="required"/>
   </complexType>
 </element>

 <element name="GetRequest">
  <annotation>
   <documentation>Request used for scalar variables</documentation>
  </annotation>
  <complexType>
    <sequence>
      <element minOccurs="1" maxOccurs="1" name="error-status" 
               type="typ:errorStatus"/>
      <element minOccurs="1" maxOccurs="1" name="error-index"
               type="unsignedInt"/>
      <element minOccurs="1" maxOccurs="1" ref="xmp:variableList"/>
    </sequence>
  </complexType>
 </element>

 <element name="SetRequest">
  <annotation>
   <documentation>Set used for scalar variables</documentation>
  </annotation>
  <complexType>
    <sequence>
      <element minOccurs="1" maxOccurs="1" name="error-status" 
               type="typ:errorStatus"/>
      <element minOccurs="1" maxOccurs="1" name="error-index"
               type="unsignedInt"/>
      <element minOccurs="1" maxOccurs="1" ref="xmp:variableList"/>
    </sequence>
  </complexType>
 </element>

 <element name="SelectTableRequest">
  <annotation>
   <documentation>Select used against MIB tables</documentation>
  </annotation>
  <complexType>
    <sequence>
      <element minOccurs="1" maxOccurs="1" name="error-status" 
               type="typ:errorStatus"/>
      <element minOccurs="1" maxOccurs="1" name="error-index"
               type="unsignedInt"/>
      <element minOccurs="1" maxOccurs="1" ref="xmp:tableInfo"/>
      <element minOccurs="1" maxOccurs="1" ref="xmp:variableList"/>
    </sequence>
  </complexType>
 </element>

 <element name="InsertTableRequest">
  <annotation>
   <documentation>Insert used against MIB tables</documentation>
  </annotation>
  <complexType>
    <sequence>
      <element minOccurs="1" maxOccurs="1" name="error-status" 
               type="typ:errorStatus"/>
      <element minOccurs="1" maxOccurs="1" name="error-index"
               type="unsignedInt"/>
      <element minOccurs="1" maxOccurs="1" ref="xmp:tableInfo"/>
      <element minOccurs="1" maxOccurs="1" ref="xmp:variableList"/>
    </sequence>
  </complexType>
 </element>

 <element name="DeleteTableRequest">
  <annotation>
   <documentation>Delete used against MIB tables</documentation>
  </annotation>
  <complexType>
    <sequence>
      <element minOccurs="1" maxOccurs="1" name="error-status" 
               type="typ:errorStatus"/>
      <element minOccurs="1" maxOccurs="1" name="error-index"
               type="unsignedInt"/>
      <element minOccurs="1" maxOccurs="1" ref="xmp:tableInfo"/>
      <element minOccurs="1" maxOccurs="1" ref="xmp:variableList"/>
    </sequence>
  </complexType>
 </element>

 <element name="UpdateTableRequest">
  <annotation>
   <documentation>Update used against MIB tables</documentation>
  </annotation>
  <complexType>
    <sequence>
      <element minOccurs="1" maxOccurs="1" name="error-status" 
               type="typ:errorStatus"/>
      <element minOccurs="1" maxOccurs="1" name="error-index"
               type="unsignedInt"/>
      <element minOccurs="1" maxOccurs="1" ref="xmp:tableInfo"/>
      <element minOccurs="1" maxOccurs="1" ref="xmp:variableList"/>
    </sequence>
  </complexType>
 </element>

 <element name="Trap">
  <annotation>
   <documentation>Trap PDU used for events and notifications</documentation>
  </annotation>
  <complexType>
    <sequence>
      <element minOccurs="1" maxOccurs="1" name="error-status" 
               type="typ:errorStatus"/>
      <element minOccurs="1" maxOccurs="1" name="error-index"
               type="unsignedInt"/>
      <element minOccurs="1" maxOccurs="1" ref="xmp:variableList"/>
    </sequence>
  </complexType>
 </element>

 <element name="Information">
  <annotation>
   <documentation>Information PDU used for FYIs</documentation>
  </annotation>
  <complexType>
    <sequence>
      <element minOccurs="1" maxOccurs="1" name="error-status" 
               type="typ:errorStatus"/>
      <element minOccurs="1" maxOccurs="1" name="error-index"
               type="unsignedInt"/>
      <element minOccurs="1" maxOccurs="1" ref="xmp:variableList"/>
    </sequence>
  </complexType>
 </element>

 <element name="Response">
  <annotation>
   <documentation>Response used as answer to all queries both scalar
    and tabular</documentation>
  </annotation>
  <complexType>
    <sequence>
      <element minOccurs="1" maxOccurs="1" name="error-status" 
               type="typ:errorStatus"/>
      <element minOccurs="1" maxOccurs="1" name="error-index"
               type="unsignedInt"/>
      <element minOccurs="0" maxOccurs="1" ref="xmp:tableInfo"/>
      <element minOccurs="1" maxOccurs="1" ref="xmp:variableList"/>
    </sequence>
  </complexType>
 </element>

 <element name="tableInfo">
  <annotation>
   <documentation>Table info element must be included in all tabular PDUs</documentation>
  </annotation>
   <complexType>
   <sequence>
   <element minOccurs="1" maxOccurs="1" name="mib" type="string"/>
   <element minOccurs="1" maxOccurs="1" name="object" type="string"/>
   <element minOccurs="1" maxOccurs="1" name="key" type="string"/>
   <element minOccurs="1" maxOccurs="1" name="max-rows" type="string"/>
   </sequence>
   </complexType>
 </element>

 <element name="variableList">
  <annotation>
   <documentation>variableList clause included in all PDUs and
      contains one more more variable elements</documentation> 
  </annotation>
  <complexType>
     <sequence>
       <element minOccurs="1" maxOccurs="unbounded" ref="xmp:variable"/>
     </sequence>
  </complexType>
 </element>

 <element name="variable">
  <annotation>
    <documentation>variable defines a MIB variable, instance, and optional value</documentation>
  </annotation>
  <complexType>
   <sequence>
     <element minOccurs="1" maxOccurs="1" ref="xmp:varname"/>
     <element minOccurs="1" maxOccurs="1" ref="xmp:varvalue"/>
   </sequence>
  </complexType>
 </element>

 <element name="varname">
  <complexType>
   <sequence>
    <element minOccurs="1" maxOccurs="1" name="mib" type="string"/>
    <element minOccurs="1" maxOccurs="1" name="object" type="string"/>
    <element minOccurs="1" maxOccurs="1" name="key" type="string"/>
   </sequence>
  </complexType>
 </element>

 <element name="varvalue"> 
  <complexType>
   <simpleContent>
     <extension base="string">
      <attribute name="vartype" use="required" type="typ:xmpSyntax"/>
     </extension>
   </simpleContent>
  </complexType>
 </element>

</schema>
