<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://www.digitalpreservation.gov/schemas/legislative"
            xmlns="http://www.digitalpreservation.gov/schemas/legislative"
            elementFormDefault="qualified">

<!-- Change History:

     April 13, 2009   1. Added documentation throughout schema.
                      2. Added simpletype list for "document.types".
                      3. Added simpletype list for "body.types".
                      4. Made meta.body repeatable.
                      5. Added optional and repeatable meta.signer.
     July 2, 2009     1. Completed adding documentation throughout schema.

     V2.0.0
     August 12, 2010  1.  Revised names of metadata elements to remove "meta." prefix.
                      2.  Added "event." as prefix for children of <event> element.
                      3.  Changed <body> within <jurisdiction> to be nonrepeatable.
                      4.  Changed <agent.block> to be required.
                      5.  Changed <author> within <agent> to be optional.
                      6.  Changed <session.block> to be required.
                      7.  Changed <legislative.session> within <session> to be optional.
                      8.  Changed <version.of> within <relation> to be optional and repeatable.
                      9.  Changed <engrossment> within <relation> to be optional and repeatable.
                      10. Changed <companion.bill> within <relation> to be optional and repeatable.
                      11. Changed <chapter> within <relation> to be optional and nonrepeatable.
                      12. Changed <governor.action> to be nonrepeatable.
                      13. Changed <event.date.time> within <event> to be required.
                      14. Changed <rights.block> to be required.

      V2.1.0
      September 27, 2010
                      1.  Added "unknown" to list of values for <body> element.
                      2.  Added "assembly" and "Assembly" to list of values for <body> element.
                      3.  Replaced <state> with <state.code> and <state.name>.
                      4.  Added to list of "document.types" for <type> element:
                           "law"
                           "Law"
                           "statute"
                           "Statute"
                           "rule"
                           "Rule"
                           "code"
                           "Code"
                      5.  Changed <date.block> to be required.
                      6.  Renamed <date> as <publication.date>.
                      7.  Added new <creation.date> as optional within <date.block>.
                      8.  Changed datatype of <publication.date> from "string" to "date".
                      9.  Changed <session.block> to be optional.
                      10.  Changed datatype of <legislative.session> from "string" to "nonNegativeInteger".
                      11. Changed datatype of <session.year> from "string" to "gYear".
                      12. Changed datatype of <session.number> from "string" to "nonNegativeInteger".
                      13. Added datatype of "postal.code" for <state.code> values.

      V2.1.1
      September 27, 2010
                      1.  Removed <creation.date>.

      V2.1.2
      October 1, 2010
                      1.  Added to list of "document.types" for <type> element:
                           "law"
                           "Law"
                           "statute"
                           "Statute"
                           "rule"
                           "Rule"
                           "code"
                           "Code"
                          (This was missed in V2.1.0 revision.)

      V2.1.3
      December 3, 2011
                      1.  Made <state.name> optional.
                      2.  Removed <signer> from <agent>.
                      3.  Removed <engrossment> from <relation>.
-->

<!-- root element -->

    <xsd:element name="document">
        <xsd:annotation>
           <xsd:documentation>The root element for the document instance.</xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
            <xsd:sequence>
               <xsd:element ref="metadata" />
               <xsd:element ref="xml.source" />
               <xsd:element ref="html.rendition" minOccurs="0" />
               <xsd:element ref="attachments" minOccurs="0" />
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>



<!-- controlled vocabulary lists -->

    <xsd:simpleType name="document.types">
        <xsd:annotation>
           <xsd:documentation>Bill = A proposal for a new law, a change in current law, repeal of a current law, or for a constitutional amendment.  Resolution = Formal actions of the legislature which express intent on the part of one or both bodies, but are not codified upon passage.  Act = The official name for a bill that has been enrolled for presentation to the governor. Each act is assigned a chapter number.  Chapter = Chapter is short for Session Law chapter.  This is the final document after action by the legislature, governor, and Secretary of State.</xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:normalizedString">
            <xsd:enumeration value="act"/>
            <xsd:enumeration value="Act"/>
            <xsd:enumeration value="bill"/>
            <xsd:enumeration value="Bill"/>
            <xsd:enumeration value="chapter"/>
            <xsd:enumeration value="Chapter"/>
            <xsd:enumeration value="code"/>
            <xsd:enumeration value="Code"/>
            <xsd:enumeration value="law"/>
            <xsd:enumeration value="Law"/>
            <xsd:enumeration value="resolution"/>
            <xsd:enumeration value="Resolution"/>
            <xsd:enumeration value="rule"/>
            <xsd:enumeration value="Rule"/>
            <xsd:enumeration value="statute"/>
            <xsd:enumeration value="Statute"/>
        </xsd:restriction>
    </xsd:simpleType>


    <xsd:simpleType name="body.types">
        <xsd:annotation>
           <xsd:documentation>Types of legislative bodies.</xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:normalizedString">
            <xsd:enumeration value="house"/>
            <xsd:enumeration value="House"/>
            <xsd:enumeration value="senate"/>
            <xsd:enumeration value="Senate"/>
            <xsd:enumeration value="assembly"/>
            <xsd:enumeration value="Assembly"/>
            <xsd:enumeration value="unknown"/>
        </xsd:restriction>
    </xsd:simpleType>


<!-- custom datatypes -->

    <xsd:simpleType name="postal.code">
       <xsd:restriction base="xsd:string">
          <xsd:pattern value="[A-Z]{2}"/>
       </xsd:restriction>
    </xsd:simpleType>


<!-- metadata -->

    <xsd:element name="metadata">
        <xsd:complexType>
            <xsd:sequence>

               <xsd:element name="identifier.block">
                  <xsd:annotation>
                    <xsd:documentation>Container for one or more identifier instances.</xsd:documentation>
                  </xsd:annotation>
                  <xsd:complexType>
                    <xsd:sequence>
                       <xsd:element name="identifier" type="xsd:string" minOccurs="1" maxOccurs="unbounded">
                          <xsd:annotation>
                            <xsd:documentation>A unique code for the document.</xsd:documentation>
                          </xsd:annotation>
                       </xsd:element>
                    </xsd:sequence>
                  </xsd:complexType>
               </xsd:element>

               <xsd:element name="title.block">
                  <xsd:annotation>
                    <xsd:documentation>Container for one or more title instances.</xsd:documentation>
                  </xsd:annotation>
                  <xsd:complexType>
                    <xsd:sequence>
                       <xsd:element name="title" type="xsd:string" minOccurs="1" maxOccurs="unbounded">
                          <xsd:annotation>
                            <xsd:documentation>The name given to the document.</xsd:documentation>
                          </xsd:annotation>
                       </xsd:element>
                    </xsd:sequence>
                  </xsd:complexType>
               </xsd:element>

               <xsd:element name="type.block">
                  <xsd:annotation>
                    <xsd:documentation>Container for one or more type instances.</xsd:documentation>
                  </xsd:annotation>
                  <xsd:complexType>
                    <xsd:sequence>
                       <xsd:element name="type" type="document.types" minOccurs="1" maxOccurs="unbounded">
                          <xsd:annotation>
                            <xsd:documentation>The recognized form or genre of the document.  Refer to the definition for "document.types" for more details about the values.</xsd:documentation>
                          </xsd:annotation>
                       </xsd:element>
                    </xsd:sequence>
                  </xsd:complexType>
               </xsd:element>

               <xsd:element name="jurisdiction.block">
                  <xsd:annotation>
                    <xsd:documentation>Container for one or more jurisdiction instances.</xsd:documentation>
                  </xsd:annotation>
                  <xsd:complexType>
                    <xsd:sequence>
                       <xsd:element name="jurisdiction" minOccurs="1" maxOccurs="unbounded">
                          <xsd:annotation>
                            <xsd:documentation>The jurisdiction associated with the document.</xsd:documentation>
                          </xsd:annotation>
                          <xsd:complexType>
                            <xsd:sequence>
                               <xsd:element name="state.code" type="postal.code" minOccurs="1" maxOccurs="1">
                                  <xsd:annotation>
                                     <xsd:documentation>The state code associated with the document.  (Values=Abbreviation as specified by ISO 3166-2:US.)</xsd:documentation>
                                  </xsd:annotation>
                               </xsd:element>
                               <xsd:element name="state.name" type="xsd:string" minOccurs="0" maxOccurs="1">
                                  <xsd:annotation>
                                     <xsd:documentation>The state name associated with the document.</xsd:documentation>
                                  </xsd:annotation>
                               </xsd:element>
                               <xsd:element name="body" type="body.types" minOccurs="0" maxOccurs="1">
                                  <xsd:annotation>
                                     <xsd:documentation>The legislative body that created the document.  (Values="House" or "Senate".)</xsd:documentation>
                                  </xsd:annotation>
                               </xsd:element>
                            </xsd:sequence>
                          </xsd:complexType>
                       </xsd:element>
                    </xsd:sequence>
                  </xsd:complexType>
               </xsd:element>

               <xsd:element name="agent.block">
                  <xsd:annotation>
                    <xsd:documentation>Container for one or more agent instances.</xsd:documentation>
                  </xsd:annotation>
                  <xsd:complexType>
                    <xsd:sequence>
                       <xsd:element name="agent" maxOccurs="unbounded">
                          <xsd:annotation>
                              <xsd:documentation>The agency, organizational unit, or individual associated with the creation or publication of the document.</xsd:documentation>
                          </xsd:annotation>
                          <xsd:complexType>
                            <xsd:sequence>
                               <xsd:element name="publisher" type="xsd:string" maxOccurs="unbounded">
                                  <xsd:annotation>
                                     <xsd:documentation>The agency or organizational unit responsible for making the document available.</xsd:documentation>
                                  </xsd:annotation>
                               </xsd:element>
                               <xsd:element name="author" type="xsd:string" minOccurs="0" maxOccurs="unbounded">
                                  <xsd:annotation>
                                     <xsd:documentation>The agency, organizational unit, and/or individual primarily responsible for the content of the document. Equates to the term "Creator" or "Originator" used in some environments.</xsd:documentation>
                                  </xsd:annotation>
                               </xsd:element>
                            </xsd:sequence>
                          </xsd:complexType>
                       </xsd:element>
                    </xsd:sequence>
                  </xsd:complexType>
               </xsd:element>

               <xsd:element name="date.block" minOccurs="1">
                  <xsd:annotation>
                    <xsd:documentation>Container for one or more date instances.</xsd:documentation>
                  </xsd:annotation>
                  <xsd:complexType>
                    <xsd:sequence>
                       <xsd:element name="publication.date" type="xsd:date" maxOccurs="unbounded">
                          <xsd:annotation>
                             <xsd:documentation>Date of publication.  Date document became publically available.  Use standard ISO 8601 (YYYY-MM-DD).</xsd:documentation>
                          </xsd:annotation>
                       </xsd:element>
                    </xsd:sequence>
                  </xsd:complexType>
               </xsd:element>

               <xsd:element name="session.block" minOccurs="0">
                  <xsd:annotation>
                    <xsd:documentation>Container for one or more session instances.</xsd:documentation>
                  </xsd:annotation>
                  <xsd:complexType>
                    <xsd:sequence>
                       <xsd:element name="session" maxOccurs="unbounded">
                          <xsd:annotation><xsd:documentation>Identifies a specific assembly of the legislature.</xsd:documentation></xsd:annotation>
                          <xsd:complexType>
                            <xsd:sequence>
                               <xsd:element name="legislative.session" minOccurs="0" type="xsd:nonNegativeInteger">
                                  <xsd:annotation><xsd:documentation>Sequential meeting of the legislature in regular session as designated by the state constitution.</xsd:documentation></xsd:annotation>
                               </xsd:element>
                               <xsd:element name="session.year" type="xsd:gYear">
                                  <xsd:annotation><xsd:documentation>The year the document was published.</xsd:documentation></xsd:annotation>
                               </xsd:element>
                               <xsd:element name="session.number" type="xsd:nonNegativeInteger">
                                  <xsd:annotation><xsd:documentation>The sequential session number in a calendar year.  0 means regular legislative session.</xsd:documentation></xsd:annotation>
                               </xsd:element>
                            </xsd:sequence>
                          </xsd:complexType>
                       </xsd:element>
                    </xsd:sequence>
                  </xsd:complexType>
               </xsd:element>

               <xsd:element name="description.block" minOccurs="0">
                  <xsd:annotation>
                    <xsd:documentation>Container for one or more description instances.</xsd:documentation>
                  </xsd:annotation>
                  <xsd:complexType>
                    <xsd:sequence>
                       <xsd:element name="description" type="xsd:string" maxOccurs="unbounded">
                          <xsd:annotation><xsd:documentation>A summary, in free-text prose, of the content of the document.</xsd:documentation></xsd:annotation>
                       </xsd:element>
                    </xsd:sequence>
                  </xsd:complexType>
               </xsd:element>

               <xsd:element name="subject.block" minOccurs="0">
                  <xsd:annotation>
                    <xsd:documentation>Container for one or more subject instances.</xsd:documentation>
                  </xsd:annotation>
                  <xsd:complexType>
                    <xsd:sequence>
                       <xsd:element name="subject" type="xsd:string" maxOccurs="unbounded">
                          <xsd:annotation><xsd:documentation>The subject matter or topic of the document.</xsd:documentation></xsd:annotation>
                       </xsd:element>
                    </xsd:sequence>
                  </xsd:complexType>
               </xsd:element>

               <xsd:element name="relation.block" minOccurs="0">
                  <xsd:annotation>
                    <xsd:documentation>Container for one or more relation instances.</xsd:documentation>
                  </xsd:annotation>
                  <xsd:complexType>
                    <xsd:sequence>
                       <xsd:element name="relation" maxOccurs="unbounded">
                          <xsd:annotation><xsd:documentation>Container for the parts of one meta.relation instance, the link between one document and another.</xsd:documentation></xsd:annotation>
                          <xsd:complexType>
                            <xsd:sequence>
                               <xsd:element name="version.of" minOccurs="0" maxOccurs="unbounded" type="xsd:string">
                                  <xsd:annotation><xsd:documentation>The version of a document.</xsd:documentation></xsd:annotation>
                               </xsd:element>
                               <xsd:element name="companion.bill" minOccurs="0" maxOccurs="unbounded" type="xsd:string">
                                  <xsd:annotation><xsd:documentation>A companion bill is usually an identical bill introduced in the other body.</xsd:documentation></xsd:annotation>
                               </xsd:element>
                               <xsd:element name="chapter" minOccurs="0" maxOccurs="1" type="xsd:string">
                                  <xsd:annotation><xsd:documentation>The number assigned to an enrollment.  This number becomes the session law chapter number if the enrollment becomes a Session Law.</xsd:documentation></xsd:annotation>
                               </xsd:element>
                            </xsd:sequence>
                          </xsd:complexType>
                       </xsd:element>
                    </xsd:sequence>
                  </xsd:complexType>
               </xsd:element>

               <xsd:element name="governor.block" minOccurs="0">
                  <xsd:annotation>
                    <xsd:documentation>Container for one or more governor.action instances.</xsd:documentation>
                  </xsd:annotation>
                  <xsd:complexType>
                    <xsd:sequence>
                       <xsd:element name="governor.action" type="xsd:string" maxOccurs="1">
                          <xsd:annotation><xsd:documentation>This element only applies to enrollments passed by both bodies of the legislature.  The governor has several options when considering an enrollment.  (Refer to the documentation for allowed values.)</xsd:documentation></xsd:annotation>
                       </xsd:element>
                    </xsd:sequence>
                  </xsd:complexType>
               </xsd:element>

               <xsd:element name="management.history.block" minOccurs="0">
                  <xsd:annotation>
                    <xsd:documentation>Container for one or more management.history instances.</xsd:documentation>
                  </xsd:annotation>
                  <xsd:complexType>
                    <xsd:sequence>
                       <xsd:element name="management.history" maxOccurs="unbounded">
                          <xsd:annotation><xsd:documentation>Container for the parts of management history, the date and description of management actions performed on the document.</xsd:documentation></xsd:annotation>
                          <xsd:complexType>
                            <xsd:sequence>
                               <xsd:element name="event" maxOccurs="unbounded">
                                  <xsd:annotation><xsd:documentation>Container for the parts of one event instance.</xsd:documentation></xsd:annotation>
                                  <xsd:complexType>
                                     <xsd:sequence>
                                        <xsd:element name="event.date.time" minOccurs="1" maxOccurs="1" type="xsd:string">
                                           <xsd:annotation><xsd:documentation>The date and time at which a defined management event occurs.  Use standard ISO 8601 (YYYY-MM-DD and hh-mm).</xsd:documentation></xsd:annotation>
                                        </xsd:element>
                                        <xsd:element name="event.type" minOccurs="1" maxOccurs="1" type="xsd:string">
                                           <xsd:annotation><xsd:documentation>An event which relates to the management of the document.  (See documentation for list of values.)</xsd:documentation></xsd:annotation>
                                        </xsd:element>
                                        <xsd:element name="event.description" minOccurs="0" maxOccurs="1" type="xsd:string">
                                           <xsd:annotation><xsd:documentation>The specific details of the event in free-text prose.</xsd:documentation></xsd:annotation>
                                        </xsd:element>
                                     </xsd:sequence>
                                  </xsd:complexType>
                               </xsd:element>
                            </xsd:sequence>
                          </xsd:complexType>
                       </xsd:element>
                    </xsd:sequence>
                  </xsd:complexType>
               </xsd:element>

               <xsd:element name="rights.block">
                  <xsd:annotation>
                    <xsd:documentation>Container for one or more rights instances.</xsd:documentation>
                  </xsd:annotation>
                  <xsd:complexType>
                    <xsd:sequence>
                       <xsd:element name="rights" type="xsd:string" maxOccurs="unbounded">
                          <xsd:annotation><xsd:documentation>A description of use restrictions, such as copyright notice, placed on the document.  Example: Copyright (C) 2008 by the Office of the Revisor of Statutes, State of Minnesota. All rights reserved.</xsd:documentation></xsd:annotation>
                       </xsd:element>
                    </xsd:sequence>
                  </xsd:complexType>
               </xsd:element>

               <xsd:element name="meta" minOccurs="0" maxOccurs="unbounded">
                  <xsd:annotation>
                    <xsd:documentation>Optional general-purpose "tag/value" pair of metadata elements.  This is for use if a standard metadata element is not available within the schema.  It should be used only when additional documentation is supplied by the provider to define the purpose of this metadata.</xsd:documentation>
                  </xsd:annotation>
                  <xsd:complexType>
                     <xsd:attribute name="tag" type="xsd:string"/>
                     <xsd:attribute name="value" type="xsd:string"/>
                  </xsd:complexType>
               </xsd:element>

            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>



<!-- XML source ("native" source from jurisdiction) -->

    <xsd:element name="xml.source">
        <xsd:annotation>
            <xsd:documentation>XML source, in the provider's native syntax.  This is not validated but is simply encapsulated within the CDATA marked section.  Use of CDATA is necessary because named entities may be contained within the XML source.</xsd:documentation>
        </xsd:annotation>
        <xsd:complexType mixed="true">
            <xsd:sequence>
               <xsd:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>



<!-- HTML rendition -->

    <xsd:element name="html.rendition">
        <xsd:annotation>
            <xsd:documentation>An HTML rendition of the document being interchanged.  This is not validated but is simply encapsulated within the CDATA marked section.  Use of CDATA is necessary because named entities may be contained within the XML source.</xsd:documentation>
        </xsd:annotation>
        <xsd:complexType mixed="true">
            <xsd:sequence>
               <xsd:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>



<!-- attachments -->

    <xsd:element name="attachments">
        <xsd:annotation>
            <xsd:documentation>A block of one or more attachments.  These attachments are an encoded version of a binary format, such as PDF or Word or other proprietary delivery format.  By encoding it (using Base64 or other "7-bit-safe" format) and enclosing it within a CDATA marked section, the provider may include other types of versions of the document.</xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
            <xsd:sequence>
               <xsd:element name="binary">
                  <xsd:annotation>
                      <xsd:documentation>One attachment.  Specify an ID for reference.  Specify the type of encoding for applications to use for processing.   Specify the source (as MIME type).</xsd:documentation>
                  </xsd:annotation>
                  <xsd:complexType mixed="true">
                       <xsd:attribute name="ID" type="xsd:ID" use="required" />
                       <xsd:attribute name="encoding" use="required">
                           <xsd:simpleType>
                               <xsd:restriction base="xsd:NMTOKEN">
                                   <xsd:enumeration value="Base64"/>
                                   <xsd:enumeration value="US-ASCII"/>
                               </xsd:restriction>
                           </xsd:simpleType>
                       </xsd:attribute>
                       <xsd:attribute name="source" use="required">
                           <xsd:simpleType>
                               <xsd:restriction base="xsd:normalizedString">
                                   <xsd:enumeration value="application/eps"/>
                                   <xsd:enumeration value="application/msword"/>
                                   <xsd:enumeration value="application/pdf"/>
                                   <xsd:enumeration value="application/zip"/>
                                   <xsd:enumeration value="text/rtf"/>
                                   <xsd:enumeration value="text/plain"/>
                               </xsd:restriction>
                           </xsd:simpleType>
                       </xsd:attribute>
                    </xsd:complexType>
                </xsd:element>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>


</xsd:schema>


