Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation  Back up to About Overview 
  
[+] Expand All
[-] Collapse All

Client Response Schema Example

The following example shows an XML schema for client responses, which you can use to machine-validate the input to the XML interface.

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
  <xs:element name="envelope">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="header"/>
        <xs:element ref="body"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="header">
    <xs:complexType/>
  </xs:element>
  <xs:element name="body">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="clientResults"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="clientResults">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="clientResult"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="clientResult">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="clientRequest"/>
        <xs:element ref="clientResponse"/>
      </xs:sequence>
      <xs:attribute name="sequence" use="required" type="xs:integer"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="clientRequest">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" ref="attributes"/>
      </xs:sequence>
      <xs:attribute name="action" use="required" type="xs:string"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="clientResponse">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="unbounded" ref="sessionResults"/>
      </xs:sequence>
      <xs:attribute name="resultCode" use="required" type="xs:integer"/>
      <xs:attribute name="resultMessage" use="required" type="xs:string"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="sessionResults">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="sessionResult"/>
      </xs:sequence>
      <xs:attribute name="type" use="required" type="xs:string"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="sessionResult">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" ref="sessionData"/>
        <xs:element ref="sessionRequest"/>
        <xs:element minOccurs="0" ref="deviceResults"/>
        <xs:element ref="sessionResponse"/>
      </xs:sequence>
      <xs:attribute name="sequence" use="required" type="xs:integer"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="sessionData">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="attributes"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="sessionRequest">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" ref="attributes"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="deviceResults">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="deviceResult"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="deviceResult">
    <xs:complexType>
      <xs:choice minOccurs="0">
        <xs:element ref="deviceRequestSpec"/>
        <xs:sequence>
          <xs:element ref="deviceRequest"/>
          <xs:element ref="deviceResponse"/>
        </xs:sequence>
      </xs:choice>
      <xs:attribute name="device" use="required" type="xs:string"/>
      <xs:attribute name="sequence" use="required" type="xs:integer"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="deviceRequestSpec">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="requiredAttribute"/>
        <xs:element maxOccurs="unbounded" ref="optionalAttribute"/>
        <xs:element maxOccurs="unbounded" ref="defaultAttribute"/>
        <xs:element maxOccurs="unbounded" ref="overrideAttribute"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="requiredAttribute">
    <xs:complexType>
      <xs:attribute name="name" use="required" type="xs:string"/>
      <xs:attribute name="sequence" use="required" type="xs:integer"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="optionalAttribute">
    <xs:complexType>
      <xs:attribute name="name" use="required" type="xs:string"/>
      <xs:attribute name="sequence" use="required" type="xs:integer"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="defaultAttribute">
    <xs:complexType>
      <xs:attribute name="name" use="required" type="xs:string"/>
      <xs:attribute name="sequence" use="required" type="xs:integer"/>
      <xs:attribute name="value" use="required" type="xs:string"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="overrideAttribute">
    <xs:complexType>
      <xs:attribute name="name" use="required" type="xs:string"/>
      <xs:attribute name="sequence" use="required" type="xs:integer"/>
      <xs:attribute name="value" use="required" type="xs:string"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="deviceRequest">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="attributes"/>
      </xs:sequence>
      <xs:attribute name="address" use="required" type="xs:string"/>
      <xs:attribute name="code" use="required" type="xs:string"/>
      <xs:attribute name="port" use="required" type="xs:integer"/>
      <xs:attribute name="type" use="required" type="xs:string"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="deviceResponse">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="attributes"/>
      </xs:sequence>
      <xs:attribute name="resultCode" use="required" type="xs:integer"/>
      <xs:attribute name="resultMessage" use="required" type="xs:string"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="sessionResponse">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" ref="attributes"/>
      </xs:sequence>
      <xs:attribute name="resultCode" use="required" type="xs:integer"/>
      <xs:attribute name="resultMessage" use="required" type="xs:string"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="attributes">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="attribute"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="attribute">
    <xs:complexType>
      <xs:attribute name="name" use="required" type="xs:string"/>
      <xs:attribute name="sequence" use="required" type="xs:integer"/>
      <xs:attribute name="value" use="required" type="xs:string"/>
    </xs:complexType>
  </xs:element>
</xs:schema>

Modified: 2017-03-07