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

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="urn:oasis:names:tc:avdl:0.0:mailto:avdl@oasis-open.org?:avdl:2003-09-27:a" xmlns:xhtml="http://www.w3.org/1999/xhtml" targetNamespace="urn:oasis:names:tc:avdl:0.0:mailto:avdl@oasis-open.org?:avdl:2003-09-27:a" elementFormDefault="qualified">

  <!-- ==================== header ==================== -->

  <xs:annotation id="header">
    <xs:documentation xml:lang="en">
      <xhtml:title>Proposed XML Schema for AVDL 2003-09-27</xhtml:title>
      <xhtml:h1>
        Proposed XML Schema for AVDL 2003-09-27
      </xhtml:h1>
    </xs:documentation>
  </xs:annotation>

  <!-- [[[ copyright ==================== -->

  <xs:annotation id="copyright">
    <xs:documentation xml:lang="en">

      Copyright © OASIS Open (2003). All Rights Reserved.

This document and translations of it may be copied and furnished to 
others, and derivative works that comment on or otherwise explain it 
or assist in its implementation may be prepared, copied, published 
and distributed, in whole or in part, without restriction of any kind, 
provided that the above copyright notice and this paragraph are 
included on all such copies and derivative works. However, this 
document itself may not be modified in any way, such as by removing 
the copyright notice or references to OASIS, except as needed for the 
purpose of developing OASIS specifications, in which case the 
procedures for copyrights defined in the OASIS Intellectual Property 
Rights document must be followed, or as required to translate it into 
languages other than English. 

The limited permissions granted above are perpetual and will not be 
revoked by OASIS or its successors or assigns. 

This document and the information contained herein is provided on 
an "AS IS" basis and OASIS DISCLAIMS ALL WARRANTIES, EXPRESS OR 
IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE 
USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR 
ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A 
PARTICULAR PURPOSE.

    </xs:documentation>
  </xs:annotation>

  <!-- ==================================================
  ....                        imports
  .... ================================================== 
  -->

  <!-- [[[ XHTML 1.0 ]]] -->

  <xs:import namespace="http://www.w3.org/1999/xhtml" schemaLocation="http://www.w3.org/2002/08/xhtml/xhtml1-transitional.xsd">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Here we import the XHTML 1.0 namespace so we can use it where
        human readable documentation is presented.
      </xs:documentation>
    </xs:annotation>
  </xs:import>

  <!-- [[[ xml: namespace ]]] -->

  <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd">
    <xs:annotation>
      <xs:documentation>
        Import the xml: namespace to get access to the xml:lang
        attribute groups so we can use it within 'comment-type'.
      </xs:documentation>
    </xs:annotation>
  </xs:import>

  <!-- ============================================================
  ....                               avdl
  ....
  .... Root of the avdl.xml file
  .... ============================================================ 
  -->

  <!-- [[[ avdl ]]] -->

  <xs:element name="avdl">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        This is the root element of an AVDL document. It contains a
        series of blocks, comments, and probes.  Each &lt;block&gt;
        describes a chunk of information such as a &lt;session&gt;, a
        &lt;vulnerability&gt;, etc. <xhtml:p/> 

        &lt;probes&gt; are a type of &lt;block&gt; that in addition can be
        nested inside a &lt;session&gt;.
      </xs:documentation>
    </xs:annotation>
    
    <xs:complexType>
      <xs:choice maxOccurs="unbounded">
        <xs:element name="comment" type="comment-type"/>
        <xs:element ref="root-block"/>
      </xs:choice>
      <xs:attribute name="version" type="xs:token" use="required">    
        <xs:annotation>
          <xs:documentation xml:lang="en">
            The version of the AVDL standard. Should be 1.0 for the
            first recomended version
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="provider" type="xs:token" use="required">    
        <xs:annotation>
          <xs:documentation xml:lang="en">
            The identifier of the vendor or system generating the AVDL
            output to follow. (i.e. SPI,CITADEL,NETCONTINUUM) 
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
   </xs:complexType>
    

    <!-- === keys === -->

    <xs:key name="block">
      <xs:annotation>
        <xs:documentation xml:lang="en">
          Key declaration for elements with block-id to ensure uniquenes
          within the AVDL file.
        </xs:documentation>
      </xs:annotation>
      <xs:selector xpath="*"/>
      <xs:field xpath="@id"/>
    </xs:key>
  </xs:element>

  <!-- ============================================================
  ....                     Common Complex Types
  ....
  .... These are mostly for the internal use of the avdl.xsd
  .... schema. They are not used directly by avdl.xml files.
  .... ============================================================ 
  -->

  <!-- [[[ open-attributes ]]] -->

  <xs:complexType name="open-attributes">
    <xs:annotation>
      <xs:documentation>
        This type is extended by almost all avdl types to allow
        attributes from other namespaces to be added to elements.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:restriction base="xs:anyType">
        <xs:anyAttribute namespace="##other" processContents="lax"/>
      </xs:restriction>
    </xs:complexContent>
  </xs:complexType>

  <!-- [[[ commented ]]] -->

  <xs:complexType name="commented">
    <xs:annotation>
      <xs:documentation>
        This type is extended by almost all types which allow comments
        (other than &lt;avdl&gt; itself and a few special cases).
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="open-attributes">
        <xs:sequence>
          <xs:element name="comment" type="comment-type" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- [[[ ref-type ]]] -->

  <xs:complexType name="ref-type">
    <xs:complexContent>
      <xs:extension base="commented">
        <xs:attribute name="uri" type="xs:anyURI" use="required">
          <xs:annotation>
            <xs:documentation xml:lang="en">
              A globally unique identifier for this block.
            </xs:documentation>
          </xs:annotation>
        </xs:attribute>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- [[[ datum-type ]]] -->

  <xs:complexType name="datum-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        An item of meta data.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="commented">
        <xs:attribute name="name" type="xs:QName" use="required"/>
        <xs:attribute name="type" type="type-type" default="string"/>
        <xs:attribute name="value" type="xs:token" use="required"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- [[[ value-type ]]] -->

  <xs:complexType name="value-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        An item of meta data.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="commented">
        <xs:attribute name="name" type="xs:string" use="required"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- [[[ href-property ]]] -->

  <xs:complexType name="href-property">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        HREF datatype container.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="commented">
        <xs:attribute name="uri" type="xs:anyURI" use="required"/>
        <xs:attribute name="type" type="href-type" use="required"/>
        <xs:attribute name="persistence" type="href-persistence-type"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- [[[ http-header-type ]]] -->

  <xs:complexType name="http-header-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Queries HTTP headers.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="commented">
        <xs:attribute name="name" type="xs:NCName" use="required"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- [[[ http-header-value-type ]]] -->

  <xs:complexType name="http-header-value-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Describes HTTP headers.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="http-header-type">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:group ref="validation-elements"/>
        </xs:choice>
        <xs:attribute name="value" type="xs:string" use="required">
        </xs:attribute>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- [[[ http-statusline-type ]]] -->

  <xs:complexType name="http-statusline-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Used to query the HTTP status line. If the
        'name' attribute is left out, the value is expected to hold
        the whole line instead of one of the three fields.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="commented">
        <xs:attribute name="name" use="optional">
          <xs:simpleType>
            <xs:restriction base="xs:NMTOKEN">
              <xs:enumeration value="protocol"/>
              <xs:enumeration value="status-code"/>
              <xs:enumeration value="reason-phrase"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:attribute>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- [[[ http-statusline-value-type ]]] -->

  <xs:complexType name="http-statusline-value-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Used to document the components of an HTTP status line. If the
        'name' attribute is left out, the value is expected to hold
        the whole line instead of one of the three fields.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="http-statusline-type">
        <xs:attribute name="value" type="xs:string" use="required"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- [[[ restriction-clause-type ]]] -->

  <xs:complexType name="restriction-clause-type">
    <xs:complexContent>
      <xs:extension base="commented">
        <xs:attribute name="value" type="xs:token" use="required"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  
  <!-- [[[ validation-parameter-type ]]] -->

  <xs:complexType name="validation-parameter-type">
    <xs:complexContent>
      <xs:extension base="commented">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:annotation>
            <xs:documentation xml:lang="en">
              A test or a boolean operation such as
              <xhtml:b>or</xhtml:b>. Sequences of clauses are combined
              with an implicit <xhtml:b>and</xhtml:b> operation
              between them.
            </xs:documentation>
          </xs:annotation>
          <xs:group ref="validation-elements"/>
        </xs:choice>
        <xs:attribute name="name" type="xs:NCName" use="required"/>
        <xs:attribute name="value" type="xs:string"/>

	<!-- Future placeholder to hold parameter types, e.g. client-generated, server-generated,
	static, radio-button etc. Now its represented as a generic string type. May want to
	prune this further to an itemized list. Version 2.0 -->

	<xs:attribute name="type" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- [[[ http-query-type ]]] -->

  <xs:complexType name="http-query-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Parameter definition type.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="commented">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:element name="parameter" type="validation-parameter-type"/>
        </xs:choice>
        <xs:attribute name="value" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- [[[ raw-type ]]] -->

  <xs:complexType name="raw-type" mixed="true">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        This is a way of describing raw data.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="open-attributes">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:group ref="basic-raw-elements"/>
        </xs:choice>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- [[[ parsed-type ]]] -->

  <xs:complexType name="parsed-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Base type for parsed data.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="commented">
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- [[[ parsed-request-type ]]] -->

  <xs:complexType name="parsed-request-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Base type for parsed requests.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="commented">
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- [[[ parsed-response-type ]]] -->

  <xs:complexType name="parsed-response-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Base type for parsed responses.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="commented">
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- [[[ parsed-http-request-type ]]] -->

  <xs:complexType name="parsed-http-request-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Parsed response data for http.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="parsed-request-type">
        <xs:sequence>
          <xs:element name="header" type="http-header-value-type" minOccurs="0" maxOccurs="unbounded"/>
          <xs:element name="query" type="http-query-type" minOccurs="0"/>
          <xs:element name="content" type="http-query-type" minOccurs="0"/>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- [[[ parsed-http-response-type ]]] -->

  <xs:complexType name="parsed-http-response-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Parsed response data for http.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="parsed-request-type">
        <xs:sequence>
          <xs:element name="statusline" type="http-statusline-value-type" maxOccurs="unbounded"/>
          <xs:element name="header" type="http-header-value-type" maxOccurs="unbounded"/>
          <xs:element name="content" minOccurs="0" maxOccurs="unbounded">
            <xs:complexType>
              <xs:complexContent>
                <xs:extension base="commented">
                  <xs:choice minOccurs="0" maxOccurs="unbounded">
                    <xs:element name="href" type="href-property" minOccurs="0" maxOccurs="unbounded"/>
                  </xs:choice>
                </xs:extension>
              </xs:complexContent>
            </xs:complexType>
          </xs:element>
        </xs:sequence>
        <xs:attribute name="base" type="xs:anyURI"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- [[[ http-request-type ]]] -->

  <xs:complexType name="http-request-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Classifies the request type.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="commented">
        <xs:sequence>
          <xs:element name="raw" type="raw-type"/>
          <xs:element name="parsed" type="parsed-http-request-type"/>
        </xs:sequence>
        <xs:attribute name="method" type="http-method-type" default="GET"/>
        <xs:attribute name="connection" type="xs:token"/>
        <xs:attribute name="host" type="xs:token"/>
        <xs:attribute name="request-uri" type="xs:token"/>
        <xs:attribute name="version" type="xs:token" default="HTTP/1.1"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- [[[ http-response-type ]]] -->

  <xs:complexType name="http-response-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Classifies the request type.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="commented">
        <xs:sequence>
          <xs:element name="raw" type="raw-type"/>
          <xs:element name="parsed" type="parsed-http-response-type"/>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- [[[ http-traversal-type ]]] -->

  <xs:complexType name="http-traversal-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Classifies the basic http message type.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="commented">
        <xs:sequence maxOccurs="unbounded">
          <xs:element name="request" type="http-request-type"/>
          <xs:element name="response" type="http-response-type"/>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- [[[ expansion-type ]]] -->

  <xs:complexType name="expansion-type" mixed="true">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Expands variable references and allow special markup.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="open-attributes">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:group ref="extended-raw-elements"/>
        </xs:choice>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  
  <!-- [[[ http-transaction-response-type ]]] -->

  <xs:complexType name="http-transaction-response-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Describes what to do with an http response
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="commented">
        <xs:sequence>
          <xs:element ref="expect">
          </xs:element> 
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- [[[ http-transaction-type ]]] -->

  <xs:complexType name="http-transaction-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Classifies the basic http transaction type.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="commented">
        <xs:sequence>
          <xs:element name="connection" type="expansion-type" minOccurs="0" maxOccurs="unbounded"/>
          <xs:element name="request" type="expansion-type"/>
          <xs:element name="response" type="http-transaction-response-type"/>
	  <xs:element name="content" type="regexp-type" minOccurs="0"/>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- [[[ block-type ]]] -->

  <xs:complexType name="block-type" abstract="true">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        This is the abstract base-type for blocks.  This defines data
        common to all blocks.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="commented">
        <xs:sequence>
          <xs:element name="summary" type="summary-type" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation xml:lang="en">
                A short one sentence summary.  We allow multiple instances
                of summary for different language versions.
              </xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="description" type="comment-type" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation xml:lang="en">
                A full description. It is possible to use XHTML markup
                here.  We allow multiple instances of description for
                different language versions.
              </xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="classification" type="datum-type" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>
                <xhtml:b>Example:</xhtml:b>
                <xhtml:blockquote>
                  <xhtml:tt>
                    &lt;classification xmlns:was="urn:oasis:..."
                    type="was:severity" value="was:really-really-bad"
                    /&gt;
                  </xhtml:tt>
                </xhtml:blockquote>
              </xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="datum" type="datum-type" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation xml:lang="en">
                Name-type-value triplets of meta data.
              </xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="history" type="ref-type" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation xml:lang="en">
                Reference(s) to earlier version(s) of this block, or
                documents it is based on.
              </xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
        <xs:attribute name="version" type="xs:token">
          <xs:annotation>
            <xs:documentation xml:lang="en">
              Some kind of version description of the block.
            </xs:documentation>
          </xs:annotation>
        </xs:attribute>
        <xs:attribute name="title" type="xs:token">
          <xs:annotation>
            <xs:documentation xml:lang="en">
              A human readable name. Does not have to be unique.
            </xs:documentation>
          </xs:annotation>
        </xs:attribute>
        <xs:attribute name="id" type="xs:QName"> 
          <xs:annotation>
            <xs:documentation xml:lang="en">
              A globaly unique id for this block.
            </xs:documentation>
          </xs:annotation>
        </xs:attribute>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- [[[ session-block-type ]]] -->

  <xs:complexType name="session-block-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        This is the base-class for probes.  A probe is the result from
        a scanner completing one transaction against the probed site.
        A transactions can involve several steps and can cross
        protocols. (E.g., a login to a site might start as HTTP and
        end up using HTTPS.)
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="block-type">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:group ref="descriptive-elements">
            <xs:annotation>
              <xs:documentation xml:lang="en">
                The descriptive elements -- if present -- are only
                used as documentation when inside a probe.
              </xs:documentation>
            </xs:annotation>
          </xs:group>
        </xs:choice>
        <xs:attribute name="time-stamp" type="time-stamp-type">
          <xs:annotation>
            <xs:documentation xml:lang="en">
              An absolute or relative (to the start of the session) time
              stamp.
            </xs:documentation>
          </xs:annotation>
        </xs:attribute>
        <xs:attribute name="session-ref" type="xs:QName">
          <xs:annotation>
            <xs:documentation xml:lang="en">
              An reference to the session. This attribute is only
              allowed if the block is used at the top level, and the
              it is required. (I.e., don't use for blocks already
              nested inside sessions.)
            </xs:documentation>
          </xs:annotation>
        </xs:attribute>
        <xs:attribute name="succeeded" type="xs:boolean" default="true">
          <xs:annotation>
            <xs:documentation xml:lang="en">
              Indicates if a traversal step succeeded or not. This
              allows documentation of unreachable nodes by setting
              this attribute to false.
            </xs:documentation>
          </xs:annotation>
        </xs:attribute>
        <xs:attribute name="expectation" type="expectation-type" default="none">
          <xs:annotation>
            <xs:documentation xml:lang="en">
              Allows the probing or traversing engine to indicate what
              it expected to see. For example, following a link, the
              expectation would be "success", but checking for a
              vulnerability, the expectation would be "failure".
            </xs:documentation>
          </xs:annotation>
        </xs:attribute>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- [[[ comment-type ]]] -->

  <xs:complexType name="comment-type" mixed="true">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        This contains both the text of the comment and any XHTML tags
        used to enhance it.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="open-attributes">
        <xs:sequence>
          <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax">
            <xs:annotation>
              <xs:documentation xml:lang="en">
                This allows any number of elements from any namespace
                outside of the AVDL space.
              </xs:documentation>
            </xs:annotation>
          </xs:any>
        </xs:sequence>
        <xs:attribute name="source" type="xs:anyURI"/>
        <xs:attribute ref="xml:lang"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- [[[ summary-type ]]] -->

  <xs:complexType name="summary-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        This contains a simple text summary with an optional language
        attribute.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleContent>
      <xs:extension base="xs:token">
        <xs:attribute ref="xml:lang"/>
        <xs:anyAttribute namespace="##other" processContents="lax"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <!-- [[[ remediation-type ]]] -->

  <xs:complexType name="remediation-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        A base container for all remediation specific information.
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="patch" type="patch-type" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute name="remedy-id" type="xs:QName" use="required"/>
    <xs:attribute name="remedy-description" type="xs:normalizedString" use="required"/>
    <xs:attribute name="remedy-source" type="xs:NCName"/>
    <xs:attribute name="remedy-moddate" type="time-stamp-type" use="required"/>
    <xs:attribute name="remedy-vendor" type="xs:NCName"/>
    <xs:attribute name="remedy-language" type="xs:NCName"/>
    <xs:attribute name="remedy-href" type="xs:anyURI"/>
    <xs:attribute name="remedy-code" type="xs:string"/>
  </xs:complexType>

  <!-- [[[ patch-type ]]] -->

  <xs:complexType name="patch-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        A patch description with name and HREF link.
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="patch-vendorname" type="xs:NCName"/>
    <xs:attribute name="patch-href" type="xs:anyURI"/>
    <xs:attribute name="patch-ref" type="xs:QName"/>
    <xs:attribute name="patch-lang" type="xs:NCName"/>
    <xs:attribute name="patch-switches" type="xs:normalizedString"/>
    <xs:attribute name="patch-method" type="xs:NCName"/>
  </xs:complexType>

 <!-- [[[ user-description-type ]]] -->

  <xs:complexType name="user-description-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        A user description.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="block-type">
	<xs:sequence>
	  <xs:element name="href" type="href-property" minOccurs="0" maxOccurs="unbounded"/>
	</xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- [[[ char-type ]]] -->

  <xs:complexType name="char-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Used to describe special characters used in raw blocks.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="commented">
        <xs:attribute name="count" type="xs:positiveInteger"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>


  <!-- [[[ test-script-type ]]] -->

  <xs:complexType name="test-script-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        A test-script specification.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="commented">
        <xs:sequence>
          <xs:element ref="declare" minOccurs="0" maxOccurs="unbounded"/>
          <xs:element ref="statement" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="target-ref" type="xs:QName"/>
        <xs:attribute name="id" type="xs:QName" use="required"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  
  <!-- [[[ target-type ]]] -->

  <xs:complexType name="target-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Base target description container.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="commented">
        <xs:sequence>
	  <xs:element name="os" type="value-type" minOccurs="0" maxOccurs="unbounded"/>
	  <xs:element name="arch" type="value-type" minOccurs="0" maxOccurs="unbounded"/>
	  <xs:element name="webserver" type="value-type" minOccurs="0" maxOccurs="unbounded"/>
	  <xs:element name="protocol" type="value-type" minOccurs="0" maxOccurs="unbounded"/>
	</xs:sequence>
        <xs:attribute name="id" type="xs:QName" use="required"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  
  <!-- ============================================================
  ....                       Common Simple Types
  ....
  .... Declares commonly used simple types.
  .... ============================================================ 
  -->

  <!-- [[[ type-type ]]] -->

  <xs:simpleType name="type-type">
    <xs:annotation>
      <xs:documentation>
        A simple data type that can be validated, or a QName.
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes=" validated-type-type xs:QName"/>
  </xs:simpleType>

  <!-- [[[ regexp-type ]]] -->

  <xs:simpleType name="regexp-type">
    <xs:annotation>
      <xs:documentation>
        A simple data type to contain all regular expression formats. TODO: need to extend this further.
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
    <!-- TODO: Need to add the regular expression format to represent all valid content data types. -->
    <!--      xs:pattern value=..  --> 
    </xs:restriction>
  </xs:simpleType>

  <!-- [[[ validated-type-type ]]] -->

  <xs:simpleType name="validated-type-type">
    <xs:annotation>
      <xs:documentation>
        A simple data type that can be tested for, and validated.
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:NMTOKEN">

      <!-- unsigned -->
      <xs:enumeration value="unsigned">
        <xs:annotation>
          <xs:documentation>
            [0-9]+
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>

      <!-- int -->
      <xs:enumeration value="int">
        <xs:annotation>
          <xs:documentation>
            [+-]?[0-9]+
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>

      <!-- number -->
      <xs:enumeration value="number">
        <xs:annotation>
          <xs:documentation>
            [+-]?[0-9]+(\.[0-9]*)?([eE]-?[0-9]+)?
            <xhtml:p/>
            There is no support for validating NaNs or infinities.
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>

      <!-- date -->
      <xs:enumeration value="date">
        <xs:annotation>
          <xs:documentation>
            [-]?[0-9]{4,}(-[0-9]{2}){2}(Z|[+-][0-9]{2}:[0-9]{2})?
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>

      <!-- time -->
      <xs:enumeration value="time">
        <xs:annotation>
          <xs:documentation>
            [0-9]{1,2}(:[0-9]{2}){2}(\.[0-9]*)(Z|[+-][0-9]{2}:[0-9]{2})?
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>

      <!-- date-time -->
      <xs:enumeration value="date-time">
        <xs:annotation>
          <xs:documentation>
            [-]?[0-9]{4,}(-[0-9]{2}){2}T([0-9]{2}:){2}[0-9]{2}(\.[0-9]*)(Z|[+-][0-9]{2}:[0-9]{2})?
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>

      <!-- string -->
      <xs:enumeration value="string">
        <xs:annotation>
          <xs:documentation>
            anything
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>

    </xs:restriction>
  </xs:simpleType>

  <!-- [[[ zero-to-unbounded-type ]]] -->

  <xs:simpleType name="zero-to-unbounded-type">
    <xs:annotation>
      <xs:documentation>
        A non-negative integer or the string "unbounded". Used for max-length.
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="xs:nonNegativeInteger">
      <xs:simpleType>
        <xs:restriction base="xs:NMTOKEN">
          <xs:enumeration value="unbounded"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <!-- [[[ time-stamp-type ]]] -->

  <xs:simpleType name="time-stamp-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Timestamps as either absolute (xs:dateTime) or relative
        (xs:decimal as seconds since the sessions session-start).
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="xs:dateTime xs:decimal"/>
  </xs:simpleType>

  <!-- [[[ http-method-type ]]] -->

  <xs:simpleType name="http-method-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        RFC 2616 section 5.1.1
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:enumeration value="OPTIONS"/>
      <xs:enumeration value="GET"/>
      <xs:enumeration value="HEAD"/>
      <xs:enumeration value="POST"/>
      <xs:enumeration value="PUT"/>
      <xs:enumeration value="DELETE"/>
      <xs:enumeration value="TRACE"/>
      <xs:enumeration value="CONNECT"/>
    </xs:restriction>
  </xs:simpleType>

  <!-- [[[ expectation-type ]]] -->

  <xs:simpleType name="expectation-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Describes the expectation as to the result of some operation.
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:enumeration value="success">
        <xs:annotation>
          <xs:documentation xml:lang="en">
            The operation is expected to succeed.
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="failure">
        <xs:annotation>
          <xs:documentation xml:lang="en">
            The operation is expected to fail.
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="none">
        <xs:annotation>
          <xs:documentation xml:lang="en">
            There is no expectation, neither positive, nor negative,
            as to the result of the operation.
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <!-- [[[ href-persistence-type ]]] -->

  <xs:simpleType name="href-persistence-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Describes the persistence property of a href.
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:enumeration value="export">
        <xs:annotation>
          <xs:documentation xml:lang="en">
            The href link is exportable (or visible) outside.
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="ephemeral">
        <xs:annotation>
          <xs:documentation xml:lang="en">
            The href link is non-exportable, dies when the session
            expires.
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <!-- [[[ href-type ]]] -->

  <xs:simpleType name="href-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Describes the href type.
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:enumeration value="static">
        <xs:annotation>
          <xs:documentation xml:lang="en">
            The href link is a static link.
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="dynamic">
        <xs:annotation>
          <xs:documentation xml:lang="en">
            The href link is dynamically generated.
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <!-- ============================================================
  ....                        Element Groups
  .... ============================================================ 
  -->

  <!-- [[[ descriptive-elements ]]] -->

  <xs:group name="descriptive-elements">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Together, these elements can describe a target specification,
        a test-script to run, and possible recommendation(s). Mostly one 
	would expect to see them in something like a
        vulnerability-description, but they can be included inside a
        probe as documentation.
      </xs:documentation>
    </xs:annotation>
    <xs:choice>
      <xs:element ref="target"/>
      <xs:element ref="test-script"/>
      <xs:element ref="remediation"/>
    </xs:choice>
  </xs:group>

  <!-- [[[ validation-elements ]]] -->

  <xs:group name="validation-elements">
    <xs:choice>
      <!-- validation-elements -->
      <xs:element ref="validation-clause"/>

      <!-- and -->
      <xs:element name="and">
        <xs:annotation>
          <xs:documentation xml:lang="en">
            An explicit &lt;and&gt; grouping of validation clauses.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="commented">
              <xs:choice maxOccurs="unbounded">
                <xs:group ref="validation-elements"/>
              </xs:choice>
              <xs:attributeGroup ref="category-group"/>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <!-- or -->

      <xs:element name="or">
        <xs:annotation>
          <xs:documentation xml:lang="en">
            An explicit &lt;or&gt; grouping of property clauses.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="commented">
              <xs:choice maxOccurs="unbounded">
                <xs:group ref="validation-elements"/>
              </xs:choice>
              <xs:attributeGroup ref="category-group"/>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>
      <!-- not -->

      <xs:element name="not">
        <xs:complexType>
          <xs:annotation>
            <xs:documentation xml:lang="en">
              Invert the meaning of the nested property clause
            </xs:documentation>
          </xs:annotation>
          <xs:complexContent>
            <xs:extension base="commented">
              <xs:choice>
                <xs:group ref="validation-elements"/>
              </xs:choice>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>
    </xs:choice>
  </xs:group>

  <!-- [[[ basic-raw-elements ]]] -->

  <xs:group name="basic-raw-elements">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Enumerates the basic ways of marking a raw block.
      </xs:documentation>
    </xs:annotation>
    <xs:choice>

      <!-- eol -->
      <xs:element name="eol" type="char-type">
        <xs:annotation>
          <xs:documentation xml:lang="en">
            Indicates a protocol appropriate end-of-line.
          </xs:documentation>
        </xs:annotation>
      </xs:element>

      <!-- tab -->
      <xs:element name="tab" type="char-type">
        <xs:annotation>
          <xs:documentation xml:lang="en">
            Indicates a protocol appropriate end-of-line.
          </xs:documentation>
        </xs:annotation>
      </xs:element>

      <!-- space -->
      <xs:element name="space" type="char-type">
        <xs:annotation>
          <xs:documentation xml:lang="en">
            Indicates a protocol appropriate space. This is useful to
            represent sequences of more than one space, since the
            whitespace in the raw block is normalized.
          </xs:documentation>
        </xs:annotation>
      </xs:element>

      <!-- char -->
      <xs:element name="char">
        <xs:annotation>
          <xs:documentation xml:lang="en">
            Indicates one character in the encoding specified by the
            protocol.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="char-type">
              <xs:attribute name="code" type="xs:nonNegativeInteger" use="required"/>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <!-- base64 -->
      <xs:element name="base64" type="xs:base64Binary">
        <xs:annotation>
          <xs:documentation xml:lang="en">
            A chunk of base64 data in the encoding specified by the
            protocol. (See RFC2045)
          </xs:documentation>
        </xs:annotation>
      </xs:element>

      <!-- hex -->
      <xs:element name="hex" type="xs:hexBinary">
        <xs:annotation>
          <xs:documentation xml:lang="en">
            A chunk of hex data in the encoding specified by the
            protocol.
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:choice>
  </xs:group>

  <!-- [[[ extended-raw-elements ]]] -->

  <xs:group name="extended-raw-elements">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Enumerates the extended ways of marking a raw block.
      </xs:documentation>
    </xs:annotation>
    <xs:choice>

      <xs:group ref="basic-raw-elements"/>

      <!-- var -->
      <xs:element name="var">
        <xs:annotation>
          <xs:documentation xml:lang="en">
            Substitutes the value of a variable.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="name" type="xs:NCName" use="required"/>
        </xs:complexType>
      </xs:element>

      <!-- attack -->
      <xs:element name="attack">
        <xs:annotation>
          <xs:documentation xml:lang="en">
            Marks an attack component.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType mixed="true">
          <xs:attribute name="comment" type="xs:string"/>
          <xs:attribute name="attack-id" type="xs:ID"/>
        </xs:complexType>
      </xs:element>

    </xs:choice>
  </xs:group>

  <!-- ============================================================
  ....                  Attributes and Attribute Groups
  .... ============================================================ 
  -->

  <!-- [[[ op-attribute ]]] -->

  <xs:attributeGroup name="op-attributes">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Possible comparision operations. One and only one of these
        attributes may be present at the same time.
      </xs:documentation>
    </xs:annotation>

    <!-- equals -->
    <xs:attribute name="equals" type="xs:string">
      <xs:annotation>
        <xs:documentation xml:lang="en">
          Equality.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>

    <!-- not-equals -->
    <xs:attribute name="not-equals" type="xs:string">
      <xs:annotation>
        <xs:documentation xml:lang="en">
          Not equal (exact inverse of &lt;equals&gt;).
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>

    <!-- contains -->
    <xs:attribute name="contains" type="xs:string">
      <xs:annotation>
        <xs:documentation xml:lang="en">
          Matches substring.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>

    <!-- not-contains -->
    <xs:attribute name="not-contains" type="xs:string">
      <xs:annotation>
        <xs:documentation xml:lang="en">
          Does not contain (exact inverse of &lt;contains&gt;).
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>

    <!-- less-than -->
    <xs:attribute name="less-than" type="xs:string">
      <xs:annotation>
        <xs:documentation xml:lang="en">
          Less than
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>

    <!-- greater-than -->
    <xs:attribute name="greater-than" type="xs:string">
      <xs:annotation>
        <xs:documentation xml:lang="en">
          Greater than
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>

    <!-- less-or-equals -->
    <xs:attribute name="less-or-equals" type="xs:string">
      <xs:annotation>
        <xs:documentation xml:lang="en">
          Less than or equal (exact inverse of &lt;greater-than&gt;).
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>

    <!-- greater-or-equals -->
    <xs:attribute name="greater-or-equals" type="xs:string">
      <xs:annotation>
        <xs:documentation xml:lang="en">
          Greater than or equal (exact inverse of &lt;less-than&gt;).
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>

    <!-- max-length -->
    <xs:attribute name="max-length" type="zero-to-unbounded-type">
      <xs:annotation>
        <xs:documentation xml:lang="en">
          Maximum length of data.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>

    <!-- min-length -->
    <xs:attribute name="min-length" type="xs:nonNegativeInteger">
      <xs:annotation>
        <xs:documentation xml:lang="en">
          Minimum length of data.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>

    <!-- type -->
    <xs:attribute name="type" type="validated-type-type">
      <xs:annotation>
        <xs:documentation xml:lang="en">
          Validated type
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>

    <!-- required -->
    <xs:attribute name="required" type="xs:boolean">
      <xs:annotation>
        <xs:documentation xml:lang="en">
          Specifies if the parameter is required or not. If
          <xhtml:code>required</xhtml:code> is
          <xhtml:b>true</xhtml:b> and the parameter is not
          present, then return <xhtml:b>false</xhtml:b>. All other
          combinations returns <xhtml:b>true</xhtml:b>.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>

    <!-- regex -->
    <xs:attribute name="regex" type="xs:string">
      <xs:annotation>
        <xs:documentation xml:lang="en">
          Compare using regular expression
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>

    <!-- not-regex -->
    <xs:attribute name="not-regex" type="xs:string">
      <xs:annotation>
        <xs:documentation xml:lang="en">
          Does not match using regular expression (exact inverse 
          of &lt;regex&gt;).
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>

    <!-- match -->
    <xs:attribute name="matches" type="xs:string">
      <xs:annotation>
        <xs:documentation xml:lang="en">
          Match using pattern where '*' matches anything.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>

    <!-- not-match -->
    <xs:attribute name="not-matches" type="xs:string">
      <xs:annotation>
        <xs:documentation xml:lang="en">
          Does not match using pattern where '*' matches anything
          (exact inverse of &lt;match&gt;).
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <!-- [[[ category-group ]]] -->

  <xs:attributeGroup name="category-group">
    <xs:attribute name="category" type="xs:QName">
      <xs:annotation>
        <xs:documentation xml:lang="en">
          This declares the scope that the name of key attribute is
          evaluated in.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <!-- [[[ sequence-attributes ]]] -->

  <xs:attributeGroup name="sequence-attributes">
    <xs:attribute name="sequence-number" type="xs:nonNegativeInteger">
      <xs:annotation>
        <xs:documentation xml:lang="en">
          A sequence number.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="parent-ref" type="xs:QName">
      <xs:annotation>
        <xs:documentation xml:lang="en">
          A reference to the direct parent of this step.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="derivation" type="xs:NCName">
      <xs:annotation>
        <xs:documentation xml:lang="en">
          Defines how we got here (external entry point, local reference, etc.)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="uri" type="xs:anyURI">
      <xs:annotation>
        <xs:documentation xml:lang="en">
          This steps identity.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <!-- [[[ op-modifiers ]]] -->

  <xs:attributeGroup name="op-modifiers">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Each one of these modifiers helps control compare operations.
      </xs:documentation>
    </xs:annotation>

    <xs:attribute name="preserve-space" type="xs:boolean" default="false">
      <xs:annotation>
        <xs:documentation xml:lang="en">
          Normally it is assumed that the value is normalized as if
          it was of type xs:token, but if preserve-space is true,
          then preserve whitespace.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute> 

    <xs:attribute name="numeric" type="xs:boolean" default="false">
      <xs:annotation>
        <xs:documentation xml:lang="en">
          By default, all magnitude comparisons are compared using
          lexical magnitude. If 'numeric' is true, then the
          comparision will be using numeric magnitude whenever
          possible.  
        </xs:documentation>
      </xs:annotation>
    </xs:attribute> 

    <xs:attribute name="ignore-case" type="xs:boolean" default="true">
      <xs:annotation>
        <xs:documentation xml:lang="en">
          If this is true (the default) then lexical comparision is
          done while ignoring case.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute> 
  </xs:attributeGroup>

  <!-- ============================================================
  ....                        Abstract Base Elements
  ....
  .... Used as roots for substitutionGroups.
  .... ============================================================ 
  -->

  <!-- [[[ root-block ]]] -->

  <xs:element name="root-block" abstract="true">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        This is the abstract base for all root-blocks.
      </xs:documentation>
    </xs:annotation>
  </xs:element>

  <!-- [[[ session-block ]]] -->

  <xs:element name="session-block" abstract="true">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        This is the abstract base for all session-block.
      </xs:documentation>
    </xs:annotation>
  </xs:element>

  <!-- [[[ traversal-protocol ]]] -->

  <xs:element name="traversal-protocol" abstract="true">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        This is the abstract base for all traversal-protocols.
      </xs:documentation>
    </xs:annotation>
  </xs:element>

  <!-- [[[ test-block ]]] -->

  <xs:element name="test-block" abstract="true">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        This is the abstract base block for all test configurations.
      </xs:documentation>
    </xs:annotation>
  </xs:element>

  <!-- [[[ vulnerability-description-block ]]] -->

  <xs:element name="vulnerability-description-block" abstract="true">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        This is the abstract base block for describing vulnerability descriptions.
      </xs:documentation>
    </xs:annotation>
  </xs:element>

  <!-- [[[ session-block ]]] -->

  <xs:element name="vulnerability-probe-block" abstract="true">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        This is the abstract base block for describing vulnerability probes.
      </xs:documentation>
    </xs:annotation>
  </xs:element>

  <!-- [[[ statement ]]] -->

  <xs:element name="statement" abstract="true"> 
    <xs:annotation>
      <xs:documentation xml:lang="en">
        This is the base for all statements.
      </xs:documentation>
    </xs:annotation>
  </xs:element>

  <!-- [[[ transaction-statement ]]] -->

  <xs:element name="transaction-statement" substitutionGroup="statement" abstract="true"> 
    <xs:annotation>
      <xs:documentation xml:lang="en">
        This is the base for all transaction statements.
      </xs:documentation>
    </xs:annotation>
  </xs:element>

  <!-- [[[ transaction-response-statement ]]] -->

  <xs:element name="transaction-response-statement" abstract="true"> 
    <xs:annotation>
      <xs:documentation xml:lang="en">
        This is the base for all statements in transaction responses.
      </xs:documentation>
    </xs:annotation>
  </xs:element>

  <!-- [[[ validation-clause ]]] -->

  <xs:element name="validation-clause" abstract="true">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        This is the abstract base for all validation clauses.
      </xs:documentation>
    </xs:annotation>
  </xs:element>


  <!-- ============================================================
  ....                        Top Level Elements
  ....
  .... Elements with appropriate substitution groupings.
  .... ============================================================ 
  -->

 <!-- [[[ session ]]] -->

  <xs:element name="session" substitutionGroup="root-block">
    <xs:complexType>
      <xs:annotation>
        <xs:documentation xml:lang="en">
          Each session contains one of these blocks and other blocks
          related to it (such as probes) have references to its ID.
        </xs:documentation>
      </xs:annotation>
      <xs:complexContent>
        <xs:extension base="block-type">
          <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element ref="session-block"/>
          </xs:choice>
          <xs:attribute name="target" type="xs:anyURI" use="required">
            <xs:annotation>
              <xs:documentation xml:lang="en">
                A URI that describes the host or hosts that this
                session was run against.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="session-start" type="xs:dateTime" use="required">
            <xs:annotation>
              <xs:documentation xml:lang="en">
                An absolute time stamp as to when this session was initiated.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <!-- [[[ vulnerability ]]] -->

  <xs:element name="vulnerability-description" substitutionGroup="vulnerability-probe-block">
    <xs:complexType>
      <xs:annotation>
        <xs:documentation xml:lang="en">
          This is the base-class for vulnerabilities.
        </xs:documentation>
      </xs:annotation>
      <xs:complexContent>
        <xs:extension base="block-type">
          <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:group ref="descriptive-elements"/>
          </xs:choice>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>


  <!-- [[[ traversal-step ]]] -->

  <xs:element name="traversal-step" substitutionGroup="session-block">
    <xs:complexType>
      <xs:annotation>
        <xs:documentation xml:lang="en">
          This is the base-class for stepwise traversals (such as an
          enumeration of accessible URL's at a given site)..  A probe
          is the result from a scanner completing one transaction
          against the probed site.  For example, each URL in a
          web-spiders crawl would show up as one probe.
        </xs:documentation>
      </xs:annotation>
      <xs:complexContent>
        <xs:extension base="session-block-type">
          <xs:sequence>
            <xs:element ref="traversal-protocol"/>
          </xs:sequence>
          <xs:attributeGroup ref="sequence-attributes"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <!-- [[[ test-probe ]]] -->

  <xs:element name="test-probe" substitutionGroup="session-block">
    <xs:complexType>
      <xs:annotation>
        <xs:documentation xml:lang="en">
          This is the base-class for all test related stuff.
        </xs:documentation>
      </xs:annotation>
      <xs:complexContent>
        <xs:extension base="session-block-type">
          <xs:sequence>
            <xs:element ref="test-block"/>
          </xs:sequence>
          <xs:attribute name="test-script-ref" type="xs:QName"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <!-- [[[ vulnerability-probe ]]] -->

  <xs:element name="vulnerability-probe" substitutionGroup="session-block">
    <xs:complexType>
      <xs:annotation>
        <xs:documentation xml:lang="en">
          Describes the test-script for a vulnerability.
        </xs:documentation>
      </xs:annotation>
      <xs:complexContent>
        <xs:extension base="session-block-type">
          <xs:sequence>
            <xs:element ref="test-probe"/>
            <xs:element ref="vulnerability-description"/>
          </xs:sequence>
          <xs:attribute name="vulnerability-ref" type="xs:QName"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <!-- ============================================================
  ....                          Other Elements
  ....
  .... Elements not found as top level elements.
  .... ============================================================ 
  -->

  <!-- [[[ target ]]] -->

  <xs:element name="target" type="target-type">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        It contains a series of clauses.
      </xs:documentation>
    </xs:annotation>
  </xs:element>

  <!-- [[[ test-script ]]] -->

  <xs:element name="test-script" type="test-script-type"> 
    <xs:annotation>
      <xs:documentation xml:lang="en">
        A test specification.
      </xs:documentation>
    </xs:annotation>
  </xs:element>

  <!-- [[[ remediation ]]] -->

  <xs:element name="remediation" type="remediation-type"> 
    <xs:annotation>
      <xs:documentation xml:lang="en">
        A remediation specification.
      </xs:documentation>
    </xs:annotation>
  </xs:element>

  <!-- [[[ http-traversal ]]] -->

  <xs:element name="http-traversal" type="http-traversal-type" substitutionGroup="traversal-protocol">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Describes how a traversal was performed, and the result.
      </xs:documentation>
    </xs:annotation>
  </xs:element>

  <!-- [[[ http-probe ]]] -->

  <xs:element name="http-probe" type="http-traversal-type" substitutionGroup="test-block">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Describes how a http probe was performed, and the result.
      </xs:documentation>
    </xs:annotation>
  </xs:element>

  <!-- [[[ test ]]] -->

  <xs:element name="test" substitutionGroup="validation-clause">
    <xs:complexType>
      <xs:annotation>
        <xs:documentation xml:lang="en">
          Test the current parameter for a value.
        </xs:documentation>
      </xs:annotation>
      <xs:complexContent>
        <xs:extension base="commented">

          <xs:attributeGroup ref="op-attributes">
            <xs:annotation>
              <xs:documentation xml:lang="en">
                Only one of the attributes from the op attribute group is
                allowed at a time.
              </xs:documentation>
            </xs:annotation>
          </xs:attributeGroup>

          <xs:attributeGroup ref="op-modifiers"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <!-- [[[ sequence ]]] -->

  <xs:element name="sequence" substitutionGroup="statement"> 
    <xs:annotation>
      <xs:documentation xml:lang="en">
        This is the base for all execution blocks.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="commented">
          <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element ref="statement"/>
          </xs:choice>
          <xs:attribute name="repeat" type="xs:nonNegativeInteger"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <!-- [[[ set ]]] -->

  <xs:element name="set" substitutionGroup="transaction-response-statement"> 
    <xs:annotation>
      <xs:documentation xml:lang="en">
        HTTP based transactions.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="commented">
          <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element name="statusline" type="http-statusline-type"/>
            <xs:element name="header" type="http-header-type"/>
          </xs:choice>
          <xs:attribute name="name" type="xs:NCName" use="required"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <!-- [[[ http-transaction ]]] -->

  <xs:element name="http-transaction" type="http-transaction-type" substitutionGroup="transaction-statement"> 
    <xs:annotation>
      <xs:documentation xml:lang="en">
        HTTP based transactions.
      </xs:documentation>
    </xs:annotation>
  </xs:element>

  <!-- [[[ declare ]]] -->

  <xs:element name="declare"> 
    <xs:annotation>
      <xs:documentation xml:lang="en">
        This is the base for all execution blocks.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="commented">
          <xs:attribute name="name" type="xs:NCName" use="required"/>
          <xs:attribute name="type" type="xs:QName" use="required"/>
          <xs:attribute name="default" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <!-- [[[ expect ]]] -->

  <xs:element name="expect"> 
    <xs:annotation>
      <xs:documentation xml:lang="en">
        This is the base for the expect block.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="commented">
	  <xs:sequence>
            <xs:element name="match-header" type="http-header-value-type" minOccurs="0" maxOccurs="unbounded"/>
	  </xs:sequence>
          <xs:attribute name="protocol" type="xs:NMTOKEN"/>
          <xs:attribute name="status-code" type="xs:NMTOKEN"/>
          <xs:attribute name="reason-phrase" type="xs:NMTOKEN"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <!-- ==================== footnote ==================== -->

  <xs:annotation id="footnote">
    <xs:documentation xml:lang="en">
      <xhtml:hr/>
      <xhtml:address>
        <xhtml:a href="mailto:jan@netcontinuum.com">
          Jan Bialkowski
        </xhtml:a>
      </xhtml:address>
      <xhtml:address>
        <xhtml:a href="mailto:srinivas@netcontinuum.com">
          Srinivas Mantripragada
        </xhtml:a>
      </xhtml:address>
      <xhtml:address>
        <xhtml:a href="mailto:johan@acm.org">
          Johan Strandberg
        </xhtml:a>
      </xhtml:address>
    </xs:documentation>
  </xs:annotation>
</xs:schema><!-- ==================== end ==================== -->