<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:d1="http://ns.dataone.org/service/errors/v1"
  xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.1.0"
  elementFormDefault="unqualified" attributeFormDefault="unqualified">
  <!-- 
$HeadURL: https://repository.dataone.org/software/cicore/trunk/d1_schemas/dataoneErrors.xsd $
$Id: dataoneErrors.xsd 12981 2013-12-03 15:48:58Z vieglais $

About this document:

  This XML Schema document defines a structure that is used to support 
  transmission of error information between the major components of the DataONE
  infrastructure.
  
License:

  This work was created by participants in the DataONE project, and is
  jointly copyrighted by participating institutions in DataONE. For
  more information on DataONE, see our web site at http://dataone.org.
  
    Copyright 2012
    
  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.
  
Formatting: 

  - This document should be saved as a UTF-8 encoded file.
  
  - Indent using spaces, not tabs, with two spaces per indent level.
  
  - Line wrapping should be set to 80 chars, adjusted as necessary
  
    -->
  <!-- A derived string type with at least length 1 and it must contain non-whitespace -->
  <xs:simpleType name="NonEmptyString">
    <xs:restriction base="xs:string">
      <xs:minLength value="1" />
      <xs:pattern value="[\s]*[\S][\s\S]*" />
    </xs:restriction>
  </xs:simpleType>
  
  <!-- Exception type for error serialization in DataONE -->
  <xs:complexType name="DataONEException">
    <xs:annotation>
      <xs:documentation>Defines a structure for serializing DataONE
        Exceptions.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="description" minOccurs="0" maxOccurs="1" type="xs:string"></xs:element>
      <xs:element name="traceInformation" minOccurs="0" maxOccurs="1" type="xs:anyType"></xs:element>
    </xs:sequence>
    <xs:attribute name="name" type="NonEmptyString" use="required"></xs:attribute>
    <xs:attribute name="errorCode" type="xs:integer" use="required"></xs:attribute>
    <xs:attribute name="detailCode" type="NonEmptyString" use="required"></xs:attribute>
    <xs:attribute name='identifier' type="NonEmptyString" use="optional"></xs:attribute>
    <xs:attribute name='nodeId' type="NonEmptyString" use="optional"></xs:attribute>
  </xs:complexType>  
  
  <xs:element name="error" type="DataONEException" />
</xs:schema>