<?xml version="1.0" encoding="iso-8859-1"?>
<xs:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:simpleType name="characterType">
  <xs:restriction base="xs:string">
    <xs:length value="1" />
  </xs:restriction>
</xs:simpleType>

<xs:simpleType name="uuidType">
  <xs:restriction base="xs:hexBinary">
    <xs:length value="16" fixed="true"/>
  </xs:restriction>
</xs:simpleType>

<xs:simpleType name="stringType">
  <xs:restriction base="xs:string">
    <xs:whiteSpace value="preserve" />
  </xs:restriction>
</xs:simpleType>

<xs:complexType name="datetimestampType">
  <xs:sequence>
    <xs:element name="date" type="xs:date" />
    <xs:element name="time" type="xs:time" />
  </xs:sequence>
</xs:complexType>

<xs:simpleType name="fieldType">
  <xs:restriction base="xs:integer">
    <xs:minInclusive value="16" />
    <xs:maxExclusive value="255" />
  </xs:restriction>
</xs:simpleType>

<xs:simpleType name="numhashType">
  <xs:restriction base="xs:integer">
    <xs:minInclusive value="2048" />
  </xs:restriction>
</xs:simpleType>

<xs:simpleType name="fileuuidType">
  <xs:restriction base="xs:string">
    <xs:pattern value="[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA­Z]{12}" />
  </xs:restriction>
</xs:simpleType>

  <xs:element name="passwordsafe">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="NumberHashIterations" type="numhashType" minOccurs="0" maxOccurs="1" />
        <xs:element name="unknownheaderfields" minOccurs="0" maxOccurs="1">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="field" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:base64Binary">
                      <xs:attribute name="ftype" type="fieldType" use="required" />
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="entry" maxOccurs="unbounded">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="group" type="stringType" minOccurs="0" maxOccurs="1" />
              <xs:element name="title" type="stringType" />
              <xs:element name="username" type="stringType" minOccurs="0" maxOccurs="1" />
              <xs:element name="password" type="stringType" />
              <xs:element name="url" type="stringType" minOccurs="0" maxOccurs="1" />
              <xs:element name="autotype" type="stringType" minOccurs="0" maxOccurs="1" />
              <xs:element name="notes" type="stringType" minOccurs="0" maxOccurs="1" />
              <xs:element name="uuid" type="uuidType" minOccurs="0" maxOccurs="1" />
              <xs:element name="ctime" type="datetimestampType" minOccurs="0" maxOccurs="1" />
              <xs:element name="atime" type="datetimestampType" minOccurs="0" maxOccurs="1" />
              <xs:element name="ltime" type="datetimestampType" minOccurs="0" maxOccurs="1" />
              <xs:element name="pmtime" type="datetimestampType" minOccurs="0" maxOccurs="1" />
              <xs:element name="rmtime" type="datetimestampType" minOccurs="0" maxOccurs="1" />
              <xs:element name="pwhistory" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="status" type="xs:integer" minOccurs="1" maxOccurs="1" />
                    <xs:element name="max" type="xs:integer" minOccurs="1" maxOccurs="1" />
                    <xs:element name="num" type="xs:integer" minOccurs="1" maxOccurs="1" />
                    <xs:element name="history_entries" minOccurs="0" maxOccurs="1">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="history_entry" minOccurs="0" maxOccurs="255">
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element name="changed" type="datetimestampType" minOccurs="1" maxOccurs="1" />
                                <xs:element name="oldpassword" type="stringType" minOccurs="1" maxOccurs="1" />
                              </xs:sequence>
                              <xs:attribute name="num" type="xs:integer" use="optional" />
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="unknownrecordfields" minOccurs="0" maxOccurs="1" >
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="field" minOccurs="0" maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:simpleContent>
                          <xs:extension base="xs:base64Binary">
                            <xs:attribute name="ftype" type="fieldType" use="required" />
                          </xs:extension>
                        </xs:simpleContent>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="id" type="xs:integer" use="optional" />
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="delimiter" type="characterType" use="required" />
      <xs:attribute name="Database" type="stringType" use="optional" />
      <xs:attribute name="ExportTimeStamp" type="xs:dateTime" use="optional" />
      <xs:attribute name="FromDatabaseFormat" type="stringType" use="optional" />
      <xs:attribute name="WhatSaved" type="stringType" use="optional" />
      <xs:attribute name="WhoSaved" type="stringType" use="optional" />
      <xs:attribute name="WhenLastSaved" type="xs:dateTime" use="optional" />
      <xs:attribute name="Database_uuid" type="fileuuidType" use="optional" />
    </xs:complexType>
  </xs:element>
</xs:schema>
