<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="xmlspec-ie-dm.xsl"?>
<!DOCTYPE spec SYSTEM "xmlspec.dtd" [
  <!ENTITY date.year "2001">
  <!ENTITY date.month "June">
  <!ENTITY date.MM "06">
  <!ENTITY date.day "7">
  <!ENTITY date.DD "07">
  <!ENTITY doc.date "&date.year;&date.MM;&date.DD;">
  <!ENTITY doc.prefix "WD-query-datamodel">
  <!ENTITY url.group "http://www.w3.org/XML/Group/">
  <!ENTITY url.group.ql "&url.group;xmlquery/">
  <!ENTITY url.latloc "&url.group.ql;&doc.prefix;">
  <!ENTITY url.publoc "&url.group;&date.year;/&date.MM;/&doc.prefix;-&doc.date;.html">
  <!ENTITY url.internal "&url.group;&date.year;/&date.MM;/&doc.prefix;-&doc.date;">
  <!ENTITY url.external "http://www.w3.org/TR/&date.year;/&doc.prefix;-&doc.date;/">
  <!ENTITY url.this "&url.external;">
  <!ENTITY aacute "&#225;">
    
  <!ENTITY % local.loc.class      "|loc-content">
  <!ELEMENT loc-content (#PCDATA|abbr)*>
  <!ATTLIST loc-content
            href    CDATA             #IMPLIED>
  <!ELEMENT abbr (#PCDATA)>
  <!ATTLIST abbr
            lang    CDATA             #IMPLIED
            title    CDATA            #IMPLIED>

  <!ENTITY copy   "&#169;"> <!-- copyright sign, U+00A9 ISOnum -->
  <!ENTITY reg    "&#174;"> <!-- registered sign = registered trade mark sign,
                                  U+00AE ISOnum -->

  <!ATTLIST issue
            date     CDATA             #IMPLIED
            raisedby CDATA             #IMPLIED>
  <!ENTITY % local.p.class        "| description | suggestion">
  <!ATTLIST resolution
            date     CDATA             #IMPLIED>
  <!ELEMENT description (p | olist | eg)+>
  <!ATTLIST description         
            id       ID                #IMPLIED
            role     NMTOKEN           #IMPLIED>
  <!ELEMENT suggestion (p)+>
  <!ATTLIST suggestion
            id       ID                #IMPLIED
            role     NMTOKEN           #IMPLIED>
]>
<spec w3c-doctype="wd">

<header>
  <title>XQuery 1.0 and XPath 2.0 Data Model</title>
  <version/>
  <w3c-designation>&doc.prefix;-&doc.date;</w3c-designation>
  <w3c-doctype>W3C Working Draft</w3c-doctype>
  <pubdate>
    <day>&date.day;</day>
    <month>&date.month;</month>
    <year>&date.year;</year>
  </pubdate>
  <publoc>
   <loc href="&url.this;">&url.this;</loc>
   <loc role="available-format" href="&url.this;Overview.html">HTML</loc>
   <loc role="available-format" href="&url.this;Overview.xml">XML</loc>
  </publoc>
  <latestloc>
   <loc href="http://www.w3.org/TR/query-datamodel/">http://www.w3.org/TR/query-datamodel/</loc>
    <!-- loc href="&url.latloc;">&url.latloc; /loc-->
  </latestloc>
  <prevlocs role="private">
    <loc href="http://www.w3.org/TR/2001/WD-query-datamodel-20010215/">http://www.w3.org/TR/2001/WD-query-datamodel-20010215/</loc>
  </prevlocs>
  <authlist>
    <author>
      <name>Mary Fern&aacute;ndez</name>
      <affiliation>AT&amp;T Labs</affiliation>
      <email href="mailto:mff@research.att.com">mff@research.att.com
      </email>
    </author>
    <author>
      <name>Jonathan Marsh</name>
      <affiliation>Microsoft</affiliation>
      <email href="mailto:jmarsh@microsoft.com">jmarsh@microsoft.com</email>
    </author>
  </authlist>
  <copyright>
    <p role="copyright">
    <loc href="http://www.w3.org/Consortium/Legal/ipr-notice-20000612#Copyright">Copyright</loc>
    &nbsp; &copy; 2001  
    <loc-content href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></loc-content>
    <sup>&reg;</sup>
    (<loc-content href="http://www.lcs.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></loc-content>,
    <loc-content href="http://www.inria.fr/"><abbr lang="fr" title="Institut National de Recherche en Informatique et Automatique">INRIA</abbr></loc-content>, 
    <loc href="http://www.keio.ac.jp/">Keio</loc>), All Rights Reserved.
    W3C <loc href="http://www.w3.org/Consortium/Legal/ipr-notice-20000612#Legal_Disclaimer">liability</loc>,
    <loc href="http://www.w3.org/Consortium/Legal/ipr-notice-20000612#W3C_Trademarks">trademark</loc>,
    <loc href="http://www.w3.org/Consortium/Legal/copyright-documents-19990405">document use</loc>
    and <loc href="http://www.w3.org/Consortium/Legal/copyright-software-19980720">software licensing</loc>
    rules apply.</p>
  </copyright>

  <status>
    <p>This section describes the status of this document at the time of its
    publication. Other documents may supersede this document. The latest status
    of this document series is maintained at the W3C.</p>

    <p>This is a Public Working Draft for review by W3C Members and 
    other interested parties. It is a draft document and may be updated, 
    replaced or made obsolete by other documents at any time. It is 
    inappropriate to use W3C Working Drafts as reference material or to 
    cite them as other than "work in progress". This is work in progress 
    and does not imply endorsement by the W3C membership.</p>

    <p>This document has been produced as part of the <bibref ref="xml-activity"/>, 
    following the procedures set out for the W3C Process. The document has 
    been written by the <bibref ref="XSLWG"/> and <bibref ref="XQWG"/>.</p>

    <!-- <p>The XSL and XML Query Working Groups feel that the contents of 
    this Working Draft are reasonably stable, and therefore encourages 
    feedback.</p> -->

    <p>Comments on this document should be sent to the W3C mailing list <loc href="mailto:www-xml-query-comments@w3.org">www-xml-query-comments@w3.org</loc>.
    (archived at <loc href="http://lists.w3.org/Archives/Public/www-xml-query-comments/">http://lists.w3.org/Archives/Public/www-xml-query-comments/</loc>).
    </p>

    <p>A list of current W3C Recommendations and other technical documents 
    can be found at <loc href="http://www.w3.org/TR/">http://www.w3.org/TR/</loc>.</p>
  </status>
  
  <abstract>
    <p>This document defines the W3C XQuery 1.0 and XPath 2.0 Data 
    Model, which is the data model of at least <bibref ref="XSLT"/>, 
    and <bibref ref="XQuery"/>, 
    and any other specifications that reference it.  This data model 
    is based on the data models of <bibref ref="XPath"/> and 
    <bibref ref="XQDM00"/> and replaces <bibref ref="XQDM00"/>.</p>
  </abstract>
  <langusage>
    <language id="en">English</language>
  </langusage>

  <revisiondesc role="public">
    <p>JM: 25-May-2001.
      <ulist>
        <item>
          <p>Updated stylesheet to derive from common xmlspec.xsl.</p>
        </item>
        <item>
          <p>Removed dependency on xmlquery-algebra.dtd, now extends xmlspec.dtd
          via internal subset.</p>
        </item>
        <item>
          <p>Added copyright to XML source.</p>
        </item>
        <item>
          <p>Removed mention of XPointer in the abstract.</p>
        </item>
      </ulist>
    </p>

    <p>MF: 17-May-2001.
    Per F2F discussion, tentative title 'XQuery 1.0 and XPath 2.0 Data Model'.
    Added <specref ref="Issue-0031"/>, <specref ref="Issue-0032"/>.</p>
    
    <p>MF: 02-May-2001.
      <ulist>
        <item>
          <p>Added <specref ref="textnodes"/> to explain relationship 
          between text nodes and simple-typed values.  See also 
          <specref ref="Issue-0027"/>.</p>
        </item>
        <item>
          <p>Added <specref ref="flags"/>.</p>
        </item>
        <item>
          <p>Added bounded Sequences as suggested by Michael Kay in 
          <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2001Apr/0316.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2001Apr/0316.html</loc>
          to model partial functions.</p>
        </item>
      </ulist>
    </p>
    
    <p>JM and MF: 27-Apr-2001.  
      <ulist>
        <item>
          <p>Integrated relationship of data model to Information Set 
          into subsections.</p>
        </item>
        <item>
          <p>Distributed pseudo-code of Infoset mapping in subsections.</p>
        </item>
        <item>
          <p>Addressed Mike Kay's issues in 
          <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2001Apr/0222.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2001Apr/0222.html</loc></p>
        </item>
        <item>
          <p>Added 'schema component' values that correspond to 
          components in <bibref ref="XSFD"/> as suggested by James 
          Clark in <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2001Apr/0234.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2001Apr/0234.html</loc>. 
          Currently, schema components are values, not nodes. See 
          <specref ref="Issue-0026"/>.</p>
        </item>
        <item>
          <p>Resolved issues <specref ref="Issue-0006"/>, 
          <specref ref="Issue-0013"/>, <specref ref="Issue-0014"/>, 
          <specref ref="Issue-0016"/>, <specref ref="Issue-0017"/>.
          Added issues <specref ref="Issue-0025"/>, 
          <specref ref="Issue-0026"/>.</p>
        </item>
      </ulist>
    </p>
 
    <p>MF: 27-Mar-2001.
    Major revision based on <bibref ref="XQDM00"/>.  Major changes 
    are detailed in:
    <loc href="http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2001Mar/0350.html">http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2001Mar/0350.html</loc>. 
    They include:
      <ulist>
        <item>
          <p><emph>Terminology</emph>.   'Sequence' replaces 'ordered forest'.
          All node constructors have complete names, e.g., 
          'AttributeNode' replaces 'AttrNode', 'ProcessingInstructionNode' 
          replaces 'PINode', etc.</p>
        </item>
        <item>
          <p><emph>Notation</emph>.  'Sequence&lt;ElementNode&gt;' replaces 
          '[ ElementNode ]'.  The XPath 2.0 task force agreed this 
          notation for collections would be more familiar to 
          programmers.</p>
        </item>
        <item>
          <p><emph>Conceptual</emph>. TextNodes replace ValueNodes. A primary 
          requirement of XSLT is to have access to the original 
          lexical representation of the XML document, including the 
          children of elements that are text nodes.  To support this 
          requirement, TextNodes have been added to the data model. 
          See <specref ref="textnodes"/>.</p>
          <p>ValueNodes have been eliminated.  Access to the Schema 
          simple-typed values of an element or attribute are provided 
          by the typed-value() accessor (See <specref ref="ElementNode"/>).
          The typed value of an element or attribute is derived from 
          the Schema normalized value in the PSV Infoset.</p>
          <p>This change guarantees access to the original lexical 
          form of the document.  It is not always possible to compute 
          the original lexical form from a typed simple value, but it 
          is always possible to compute the simple value from the 
          lexical form provided in the Schema normalized value in the 
          PSV Infoset.</p>
          <p>This introduces some awkwardness into the formal 
          semantics of XQuery, because when constructing a new element,  
          every simple value is (logically) converted into a text node.  
          For example, the XQuery value:</p>
          <p role="definition">&lt;a&gt;{ [1, 2] }&lt;/a&gt;</p>
          <p>is constructed by the data model expression:</p>
          <p role="definition">elementNode(qname(empty_sequence(), "a"), 
          empty_sequence(), empty_sequence(), text-node("1 2"))</p>
          <p>Applying typed_value() to the expression above yields:</p>
          <p role="definition">Sequence&lt; simpleValue(1, xs:integer), 
          simpleValue(2, xs:integer) &gt;</p>
        </item>
        <item>
          <p><emph>Conceptual</emph>: separating element construction from 'schema 
          processing'.  Currently, the elementNode constructor takes 
          both the content of the element and the runtime 
          representation of the element's type, called a 
          <emph>SchemaComponent</emph> James suggested separating 
          element construction from 'schema processing', i.e., 
          associating a runtime type with the constructed element.  
          Jerome says this better reflects what happens in an 
          implementation.</p>
          <p>Note that this is a conceptual data model only: this 
          model makes text nodes 'first class', but an implementation 
          could choose to make simple values 'first class' and 
          reconstruct text nodes on demand. This data model eliminates 
          many of the problems with the XML Query data model: 
          providing access to the original lexical form; handling 
          comments and PIs interleaved with simple values.  Overall, it 
          seems to strike a reasonable compromise of the needs of XSLT 
          and XQuery.</p>
        </item>
      </ulist>
    </p>
  </revisiondesc>
</header>

<body>

<div1>
  <head>Introduction</head>

  <p>This document defines the XQuery 1.0 and XPath 2.0 Data Model, 
  which is the data model of <bibref ref="XSLT"/> 2.0 and 
  <bibref ref="XQuery"/> 1.0.</p>

  <p>The XQuery 1.0 and XPath 2.0 Data Model (henceworth "data model") 
  serves two purposes.
  First, it defines precisely the information contained in the input to an 
  XSLT or XQuery processor.  Second, it defines all permissible values of 
  expressions in the XSLT, XQuery, and XPath languages.  A 
  language is <emph>closed</emph> with respect to a data model if the value 
  of every expression in a language is guaranteed to be in the data model. 
  XSLT 2.0, XQuery 1.0, and XPath 2.0 are all closed with respect to
  the data model.</p>
  
  <p>The data model is based on the <bibref ref="xml-infoset"/>
  (henceforth "Infoset"), but it requires the following new features to
  meet the <bibref ref="XPathReq"/> and <bibref ref="XQueryReq"/>:</p>
  
  <ulist>
    <item>
      <p>Support for XML Schema types. The XML Schema Working Group is 
      defining features, such as structures (<bibref ref="xmlschema-1"/>)
      and simple data types (<bibref ref="xmlschema-2"/>), that extend  
      the XML Information Set with precise type information.</p>
    </item>
    <item>
      <p>Representation of Collections of Documents and of Simple and
      Complex Values. (<bibref ref="XQueryReq"/>)</p>
    </item>
    <item>
      <p>Representation of References. (<bibref ref="XQueryReq"/>)</p>
    </item>
  </ulist>

  <p>As with the Infoset, the XQuery 1.0 and XPath 2.0 Data Model 
  specifies what 
  information in the documents is accessible, but it does not specify
  the programming-language interfaces or bindings used to represent or 
  access the data.</p>

  <p>Values in the data model fall into five categories:
  <emph>nodes</emph>, <emph>simple values</emph>,
  <emph>sequences</emph>, <emph>error</emph>, and <emph>schema
  components</emph>. A
  node is defined in <specref ref="nodes"/> and
 is one of eight node kinds.  Simple values are the union of all the value
  spaces of XML Schema simple types and are defined in <specref
  ref="simplevalues"/>.  A sequence is an ordered collection of nodes,
  simple values, or any mixture of nodes and simple values.  A
  sequence cannot be a member of a sequence.  Sequences are defined in
  <specref ref="sequences"/>.
 The <emph>error</emph> value is defined in <specref ref="error"/>. 
A <emph>schema component</emph> represents the type of 
element nodes, attribute nodes, and simple values, and are defined in
  <specref ref="types"/>.
 </p>
    
  <p>In this document, we provide a precise definition of how values
  in the XQuery 1.0 and XPath 2.0 Data Model are constructed and accessed, and how
  they relate to values in the Infoset.  We note
  wherever the XQuery 1.0 and XPath 2.0 Data Model differs from that of XPath
  1.0.</p>
  
</div1>

<div1>
  <head>Notation and Pseudo-code Syntax</head>

  <p>In addition to using prose, we define the data model using a functional 
  notation.  We chose this notation because it is simple and permits a 
  precise definition of the data model, suitable for use by the formal
  semantics of XQuery.  Although the notation has a functional style, we 
  emphasize that the data model can be realized in a variety of 
  programming languages and styles, for example, as object classes and 
  methods in an object-oriented language.</p>

  <p>Pseudo-code syntax is highlighted as follows:</p>

  <p role="definition">
f : (x) -> y</p>

  <p>In the psuedo-code syntax, the term <emph>Node</emph> denotes
  the category of node values, <emph>SimpleValue</emph> denotes the 
  category of simple values, and <emph>Sequence&lt;V&gt;</emph> denotes 
  the category of sequence values whose members are in category 
  <emph>V</emph>.  A <emph>UnitValue</emph> refers to a node or a 
  simple value.  In a sequence, <emph>V</emph> may be any <emph>Node</emph> 
  or <emph>SimpleValue</emph>, or the union (choice) of several 
  unit values. For example, the following denotes a sequence containing 
  comment or processing instruction nodes:</p>
  
  <p role="definition">
Sequence&lt;CommentNode | ProcessingInstructionNode&gt;</p>
  
  <p>There are some functions in the data model that are <emph>partial
  functions</emph>, for example, a node may have one parent node or no 
  parent.  We use <emph>bounded</emph> sequences, 
  <emph>Sequence(m,n)&lt;V&gt;</emph>, to denote a sequence of at least 
  <emph>m</emph> and at most <emph>n</emph> <emph>V</emph> values.
  The unbounded sequence <emph>Sequence&lt;V&gt;</emph> is
  equivalent to <emph>Sequence(0,*)&lt;V&gt;</emph>, where <emph>*</emph> 
  denotes unbounded.  For example, the <emph>parent</emph> accessor
  returns a singleton sequence, if its node argument has a parent,
  or the empty sequence, if its argument has no parent.
  The signature of <emph>parent</emph> specifies that it returns
  an empty sequence or a sequence containing one element or document node:</p>

  <p role="definition">
parent : Node -> Sequence(0,1)&lt;ElementNode | DocumentNode&gt;</p>


  <p>A <emph>SchemaComponent</emph> denotes the category of
  schema-component values.</p>

  <p>The pseudo-code syntax defines functions to construct values, 
  called <emph>constructors</emph>; and functions to access parts of 
  values, called <emph>accessors</emph>.</p>
  
<!-- 
  We use <emph>constraint expressions</emph> to specify precisely the
  relationships between a constructed value and the values returned by
  its accessors.  For example, this constraint states that 
the value returned by an element's node <emph>name</emph> accessor
is always equal to the name argument of the <emph>element-node</emph> constructor.
  </p>
  <p role="definition">
name(element-node(q, n, a, c, sc)) = q
  </p>
<p>
This constraint is obvious : we would like an element's name to be
the same as the one it was constructed to have. 
Some constraints, however, are not obvious.  For example,
the order of an element node's attributes 
do not have to be preserved by its constructor.
Constraint expressions follow the definitions of constructors and
accessors. 
</p>
-->
  <note><p>The XPath 1.0 data model defines accessors, but does not
  define constructors.</p></note>

  <p>The term <emph>signature</emph> of a 
  function specifies the value category of its zero or more inputs
  and the value category of its one output.
  The following signature denotes a function
  <emph>f</emph> that takes values in the categories
  <emph>V</emph><sub>1</sub>, ..., <emph>V</emph><sub>m</sub> and returns an output value in the
  category <emph>V</emph><sub>n</sub>.</p>

  <p role="aside">f : (<emph>V</emph><sub>1</sub>, ..., <emph>V</emph><sub>m</sub>) -> <emph>V</emph><sub>n</sub></p>

  <p>A member of a particular category is a permissible
  argument to any function that accepts the category, for example,
  a <emph>ProcessingInstructionNode</emph> is a permissible argument to a
  function expecting a <emph>Node</emph>.
  </p>

  <p>In the pseudo-code syntax describing the mapping from the 
  Infoset to the data model, we name accessors of the Infoset 
  using the convention <emph>infoset-&lt;item-name&gt;-&lt;property&gt;</emph>.  For example, 
  <emph>infoset-elem-attributes</emph> is the accessor that returns an 
  element item's attributes property:</p>

  <p role="definition">
infoset-elem-attributes : <loc href="#ElementItem">ElementItem</loc> -> Sequence&lt;<loc href="#AttributeItem">AttributeItem</loc>&gt;
  </p>

</div1>

<div1>
  <head>Concepts</head>
  <div2>
    <head>Node Identity</head>

    <p>Because XML documents are tree-structured, we define the 
    data model using conventional terminology for trees.  The data model is 
    a node-labeled, tree-constructor representation, but also includes a 
    concept of node identity.  Node identity simplifies the representation 
    of XML reference values, e.g., IDREF, XPointer, and URI values.</p>

    <p>Two nodes have the same identity if only if they were created by the
    same application of a node constructor (see <specref ref="nodes"/>).</p>
  </div2>
  
  <div2>
    <head>Document Order</head>
      
    <p>A <emph>document order</emph> is defined on all the nodes in a
    document.  It corresponds to the order in which the first
    character of the XML representation of each node occurs in the XML
    representation of the document after expansion of general
    entities. Thus, the document node is the first node. Element
    nodes occur before their children. Thus,  document order means that
    element nodes occur in the order of their start-tag in the
    XML (after expansion of entities).  The namespace nodes of an
    element occur before its attribute nodes, and the
    element's attribute nodes occur before its children.
    The relative order of namespace nodes and the relative order of
    attribute nodes are implementation-dependent.  Reverse document
    order is the reverse of document order.</p>

    <p>The relative order of nodes in distinct documents is 
    implementation-dependent but stable.  
    In other words, if <emph>n1</emph> and <emph>n2</emph> are in 
    one document, and <emph>m</emph> is in a different document, then 
    either '<emph>n1</emph> before <emph>m</emph>' is true 
    or '<emph>m</emph> before <emph>n2</emph>'  is true, 
    but both may not be true.
</p>
      
  </div2>
  
  <div2 id="psv">
    <head>XML Schemas and the XML Information Set</head>

    <p>The data model is defined in terms of the 
    <bibref ref="xml-infoset"/> after XML Schema validity assessment.
    XML Schema validity assessment is the process of assessing an XML
    element information item with respect to an XML Schema and
    augmenting it and some or all of its descendants with properties
    that provide information about validity and type assignment.
    The result of schema validity assessment is an augmented
    Infoset, known as the Post Schema-Validation Infoset, or
    PSVI.  We use the naming convention convention
    <emph>psvi-&lt;item-name&gt;-&lt;property&gt;</emph> to identify
    the accessor functions that return the PSV Infoset additions.
    </p>

    <p>The data model supports the following classes of XML documents:</p>

    <ulist>
      <item>
        <p>Schema-validated documents, i.e., those validated with respect 
        to a schema,</p>
      </item>
      <item>
        <p>DTD-valid documents, i.e., those documents validated with respect 
        to a DTD, and </p>
      </item>
      <item>
        <p>Well-formed documents with no corresponding DTD or schema.</p>
      </item>
    </ulist>

    <p>The data model does not support non-well-formed XML documents, nor
    documents that otherwise don't have an XML Information Set; for 
    example, that don't conform to XML Namespaces.</p>
    
    <p>Schema-validated documents include documents in which some elements 
    or attributes have been validated by "lax" or "skip" validation 
    (<bibref ref="xmlschema-2"/>).</p>
    
    <p>An "incompletely validated document" is an XML document that has a
    corresponding schema but whose schema-validity assessment has resulted 
    in one or more element or attribute information items being assigned 
    values other than 'valid' for the <emph role="infoset-property">validity</emph>
    property in the PSVI.</p>

    <p>The data model supports incompletely validated documents.  <specref
    ref="types"/> specifies how such documents are represented in
    the data model. 
    </p>

    <ednote><edtext>JM: This implies accommodation for the case where 
    both a DTD and a schema are applied.  This will probably require some
    reconciliation of the [attribute type] property with type 
    information from the PSVI.</edtext></ednote>

  </div2>
  
  <div2>
    <head>Schema Components and Values</head>

    <p id="def-type">
    The <bibref ref="XSFD"/> (henceforth "XSFD") is a formal, declarative system for
    describing and naming XML Schema information, specifying XML
    instance type information, and validating instances against
    schemas.  XSFD includes a component model that defines four
    <emph>schema components</emph> (<emph>simple type
    </emph>, <emph>complex type</emph>, <emph>element</emph>, and 
    <emph>attribute</emph>), and
    it defines the mapping from the XML Schema component model to the XSFD
    model.  In addition, it specifies "normalized, universal" names
    for all components of an XML Schema, so that they can be uniquely
    identified by URIs.
    </p>

    <p>The data model provides a representation for schema components,
    which are used to represent the types of values. 
    All simple values, element nodes, and attribute
    nodes have an associated schema component.  We use the term
    <emph>SchemaComponent</emph> to collectively refer to the data
    model's
    schema component values <emph>simple-type-definition</emph>, <emph>complex-type-definition</emph>,
    <emph>element-declaration</emph>, and 
    <emph>attribute-declaration</emph>.  The
    accessors for schema components are defined in <specref
    ref="types"/>.
    The schema component of element and
    attribute nodes is derived from the PSV Infoset additions of 
    the nodes' corresponding element and attribute information items.
    </p>

    <p> A schema <emph>simple type</emph> consists of a lexical space,
    a value space, and a set of facets <bibref ref="xmlschema-2"/>.
    A simple type is either <emph>primitive</emph> (e.g., <emph>xs:string,
    xs:boolean, xs:float, xs:double, xs:ID, xs:IDREF</emph>) or
    <emph>derived</emph> (e.g., <emph>xs:language, xs:NMTOKEN,
    xs:long</emph>, etc., or user defined).  We say a simple value is
    an <emph>instance</emph> of a schema simple type if the simple value is
    in the value space of the simple type.  Because the value spaces of
    schema simple types may overlap, a simple value may be an instance
    of more than one schema simple type, e.g., an instance of
    <emph>xs:integer</emph> is  also an instance of a <emph>xs:long</emph>.
    </p>

    <note>
      <p>In XPath 1.0, the data model only
      defines nodes.  The primitive data types (number, boolean, string,
      node-set) are part of the expression language, not 
      the data model.</p>
    </note>

    <p>A schema <emph>complex type</emph> defines the permissible
    structure and content of an element <bibref ref="xmlschema-1"/>.</p>

    <p>A schema <emph>attribute declaration</emph> specifies an
    attribute's name and the simple type of its value.</p>
    
    <p>A schema <emph>element declaration</emph> specifies an
    element's name and the simple or complex type of its content.</p>

  </div2>

<div2 id="textnodes">
  <head>Text Nodes and Simple-Typed Values</head>

  <p>The data model supports two representations of the character data in
  an XML document: text nodes and simple-typed values.  An element node,
  for example, has child nodes that may include text nodes, comment
  nodes, processing instruction nodes, and other element nodes.  A text
  node contains a string of consecutive character data items and is
  never followed or preceded by another text node.  In addition, the
  text content of an element may be interpreted as a simple-typed value,
  such as an integer, a date, or a sequence of prices.  To illustrate,
  consider an element node whose complex type is a sequence of
  double-precision numbers.  The element's children are three nodes: a
  text node with string contents " 12.00 ", followed by a comment node,
  followed by a text node with contents " 13.0", whereas its
  simple-typed value is a sequence containing the double-precision numbers
  12.0 and 13.0.</p>

  <p>We note that the data model logically supports both 
  text nodes and simple-typed values, 
  but it does not specify they should be implemented.  
  An implementation might choose
  to only store simple-typed values and reconstruct text nodes on
  demand, vice versa. 
  We note, however, that a simple-typed value
  does not always have 
  a unique lexical representation (<specref ref="Issue-0027"/>).</p>
</div2>

<div2 id="flags">
  <head>Ignoring Comments, Processing Instructions, and Whitespace</head>

  <p>Although the data model can preserve all comments, processing
  instructions, and whitespace characters in the Infoset, preservation of 
  these values may be unnecessary and onerous for some applications.</p>

  <p>The data model is parameterized by three flags, <emph>ignore-comments</emph>,
  <emph>ignore-processing-instructions</emph>, and <emph>ignore-whitespace</emph>,
  which affect the construction of the data model from the Infoset.  If 
  the <emph>ignore-comments</emph> flag is true, comment nodes are not 
  preserved in the data model.    If the <emph>ignore-processing-instructions</emph>
  flag is true, processing-instruction nodes are not preserved in the 
  data model.  If the <emph>ignore-whitespace</emph> flag is true, 
  insignificant white space is not preserved.</p>

<p role="definition">
ignore-comments                : xs:boolean
ignore-processing-instructions : xs:boolean
ignore-whitespace              : xs:boolean
</p>

  <p>Insignificant whitespace is defined as a text node that:</p>
  <olist>
    <item><p>contains no characters other than white space characters 
    (as defined in XML 1.0), and</p></item>
    <item><p>has a parent element with a <emph role="infoset-property">validity</emph>
    property with the value "valid", and a
    <emph role="infoset-property">type definition</emph> property yielding
    a complex type with <emph>content-type</emph> of <emph>element-only</emph>.</p></item>
  </olist>
  
  <ednote><edtext>JM: The data model itself might benefit from whitespace
  information available in the schema.  See <specref ref="Issue-0028"/>.</edtext></ednote>
</div2>

</div1>

<div1 id="nodes">
  <head>Nodes</head>
  <p>The category of <emph>Node</emph> values contains eight distinct 
  kinds of nodes: <loc href="#DocumentNode">document</loc>, 
  <loc href="#ElementNode">element</loc>, <loc href="#AttributeNode">attribute</loc>,
  <loc href="#TextNode">text</loc>, <loc href="#NamespaceNode">namespace</loc>,
  <loc href="#ProcessingInstructionNode">processing instruction</loc>, 
  <loc href="#CommentNode">comment</loc>, and <loc href="#ReferenceNode">
  reference</loc>.  The eight kinds of nodes are defined in the following 
  subsections.</p>
  
  <note>
    <p>The XPath 1.0 data model does not
    have reference nodes.  Document nodes and XPath 1.0 root nodes serve
    many of the same purposes, but are not identical.  In XPath 1.0, 
    root nodes served as containers of document fragments. 
    XPath 2.0 supports sequences as first-class objects in the data model.</p>
  </note>

  <p>Each kind of node has its own constructor.   The effect of a node
  constructor is to create a new node with a unique identity, distinct
  from all other nodes.</p>

  <p>Document nodes and element nodes have a sequence of <emph>child</emph> nodes.  A 
  document node or an element node is the parent of each of its child nodes.
  Nodes never share children: if two nodes have distinct identities, 
  then no child of one node will be a child of the other node.</p>
  
  <p>Every node has at most one <emph>parent</emph>, which is either an 
  element node or the document node.  A node that has no parent is regarded 
  as the root of a tree. The one exception is a namespace node, which never 
  has a parent. A tree contains a root plus all nodes that are reachable 
  directly or indirectly from the root via the <emph>children</emph>, 
  <emph>attributes</emph>, and <emph>namespace</emph> accessors.  Every node 
  belongs to exactly one tree, and every tree has exactly one root node.  
  A tree whose root node is a document node is referred to as a 
  <emph>document</emph>.  A tree whose root node is some other kind of node
  is referred to as a <emph>fragment</emph>.</p>

  <note>
    <p>In XPath 1.0, Namespace nodes have parents.</p>
  </note>

  <p>There is also a way of determining the <emph>string-value</emph> of 
  each kind of node.  For some kinds of node, the <emph>string-value</emph>
  is part of the node; for other kinds of node, the <emph>string-value</emph>
  is computed from the <emph>string-value</emph> of its descendant nodes.</p>

  <p>Element and attribute nodes contain a typed value,
  i.e., values that have associated schema simple type. 
  An attribute contains a sequence of simple-typed values.
  An element contains either a complex-typed value, i.e., a sequence
  of nodes, a simple-typed value, or a sequence of simple-typed values.
  <specref ref="ElementNode"/> and <specref ref="AttributeNode"/> specify 
  how the simple-typed value (<emph>typed-value</emph>) of an element or 
  attribute is accessed.</p>

  <p>The following accessors are defined on all eight
  kinds of Nodes.  The <emph>node-kind</emph> accessor returns a 
  string value representing the node's kind: either <emph>"document"</emph>, 
  <emph>"element"</emph>, <emph>"attribute"</emph>, <emph>"text"</emph>, 
  <emph>"namespace"</emph>, <emph>"processing-instruction"</emph>, 
  <emph>"comment"</emph>, or <emph>"reference"</emph>.  The 
  <emph>name</emph> accessor returns the empty sequence, if the
  node has no name, otherwise, it returns a sequence containing one
  <emph>expanded QName</emph>.  An expanded QName is in the value space 
  of <emph>xs:QName</emph>, and contains a namespace URI and a local name. 
  The <emph>parent</emph> accessor returns an empty sequence, if the
  node has no parent, otherwise, it returns a sequence containing one node.
  The <emph>string-value</emph> accessor returns the node's string 
  representation.</p>
  
  <p role="definition">
node-kind    : Node -> <loc href="#primvalue">xs:string</loc>
name         : Node -> Sequence(0,1)&lt;<loc href="#primvalue">xs:QName</loc>&gt;
parent       : Node -> Sequence(0,1)&lt;<loc href="#ElementNode">ElementNode</loc> | <loc href="#DocumentNode">DocumentNode</loc>&gt;
string-value : Node -> <loc href="#primvalue">xs:string</loc>
  </p>

  <p>The basic concept in the Infoset is an <emph>InfoItem</emph>. An
  <emph>InfoItem</emph> is one of eleven kinds of item:
  document item, element item, attribute item, processing instruction item,
  unexpanded entity item, character item, comment item, doctype
  item, unparsed entity item, notation item, and namespace item.
  Constructors
  are provided by an Infoset processor.</p>

  <p>The <emph>infoitem-kind</emph> accessor
  returns a string value representing the information item's kind:</p>

  <p role="definition" id="InfoItem">
infoitem-kind  : InfoItem -> xs:string</p> 

<div2 id="DocumentNode">
  <head>Documents</head>

  <p>A document is represented by a document node, which corresponds 
  to a <emph role="info-item">document information item</emph>.</p>
  
  <p>A document node does not have an <emph>expanded-QName</emph>.</p> 

  <p>The <emph>children</emph> of the document node are nodes corresponding
  to the information items found in the 
  <emph role="infoset-property">children</emph> property, omitting 
  any <emph role="info-item">document type declaration information 
  items</emph>.</p>

  <p>
  In a well-formed document, 
  the children of the document node consist
  exclusively of element, processing-instruction, or comment
  nodes, and exactly one of these children is an element node.  A
  document node in the data model is more permissive: it permits more
  than one element node as a child and also permits text 
  nodes as children.
  </p>

  <p>The <emph>base URI</emph> of the document corresponds to the
  <emph role="infoset-property">base URI</emph> property.</p>

  <p>The <emph>string-value</emph> of the document node is the 
  concatenation of the string-values of all text-node descendants of 
  the document node in document order.</p>
  
  <p>The <emph>parent</emph> of the document node is always the empty sequence.  A document node always represents the root of a tree.</p>
  
<!--
  <p>A document is <emph>well-formed</emph> (<bibref ref="xml-fragment"/>)
  if the children of the <code>DocumentNode</code> consist exclusively of 
  element, text, processing-instruction, or comment nodes; if exactly one 
  of these children is an <code>ElementNode</code>; and if the tree 
  rooted at the document node does not contain any <code>ReferenceNode</code>s.
  A document is <emph>well-balanced</emph> (<bibref ref="xml-fragment"/>)
  if it satisfies all the other constraints defined in this data model, 
  but is not well-formed.  When serialized using the XML output method, a 
  well-balanced document will always be a well-formed external general 
  parsed entity.</p>

  <ednote><edtext>JM: Why the references to XML Fragment Interchange here?
  Why is text included as a top level info item?  What is the point of
  this whole paragraph?  It implies some constraints, but doesn't specifically
  impose them...</edtext></ednote>

  <ednote><edtext>MF: support for document repositories. See <specref
  ref="Issue-0024"/>. </edtext></ednote>

-->
  
<p id="document-node">
  
  A document node has the constructor <emph>document-node</emph>, 
  which takes a base URI value and a non-empty sequence of its children nodes:</p>

  <p role="definition">
document-node : (<loc href="#primvalue">xs:anyURI</loc>,
                 Sequence(1,*)&lt;<loc  href="#ElementNode">ElementNode</loc> | <loc href="#TextNode">TextNode</loc> | <loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc> 
                              | <loc href="#CommentNode">CommentNode</loc>&gt;) 
             -> <loc href="#DocumentNode">DocumentNode</loc>
  </p>

  <p>The accessors <emph>base-uri</emph> and <emph>children</emph> return a 
  document node's constituent parts:</p>

  <p role="definition">
base-uri : <loc href="#DocumentNode">DocumentNode</loc> -> <loc href="#primvalue">xs:anyURI</loc>
children : <loc href="#DocumentNode">DocumentNode</loc> 
         -> Sequence(1,*)&lt;<loc href="#ElementNode">ElementNode</loc> | <loc href="#TextNode">TextNode</loc> 
                         | <loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc> | <loc href="#CommentNode">CommentNode</loc>&gt;</p>
  
  <p>The node accessors
  <emph>node-kind</emph>, <emph>parent</emph>, and
  <emph>string-value</emph> also apply to document nodes.
  A document node does not have an expanded-QName; the following
  signature specifies that <emph>name</emph> applied to a document
  node returns the empty sequence:
  </p>
  <p role="definition">
name(DocumentNode) : Sequence(0,0)&lt;xs:QName&gt;</p>

  <p>A document node is constructed from a Document Information
  Item by the <emph>dm-document-node</emph> function:</p>

  <p role="definition" id="DocumentItem">
/* Accessors for document information items: */
infoset-doc-children : <loc href="#DocumentItem">DocumentItem</loc> 
                     -> Sequence&lt;<loc
href="#ElementItem">ElementItem</loc> | <loc href="#ProcessingInstructionItem">ProcessingInstructionItem</loc> 
                                | <loc href="#CommentItem">CommentItem</loc> | DocTypeItem&gt;
infoset-doc-base-uri : <loc href="#DocumentItem">DocumentItem</loc> -> <loc href="#primvalue">xs:anyURI</loc>
  </p>
  <p role="definition" id="dm-document-node">
dm-document-node : <loc href="#DocumentItem">DocumentItem</loc> -> <loc href="#DocumentNode">DocumentNode</loc>
function dm-document-node(d) { 
  kids = dm-collapse-text-nodes(sequence-map(dm-node,
                                infoset-doc-children(d)))
  return <loc href="#DocumentNode">document-node</loc>(infoset-doc-base-uri(d), kids)
}
</p>

    
  <p>The <emph>sequence-map</emph> function applies its first function
  argument to each member of
  its second sequence argument and 
  returns  a new sequence containing the result of applying the function
  to each member of the sequence.  Below, <emph>dm-node</emph> is
  applied to each child of the Document Information Item
  value <emph>d</emph> and a new sequence 
  of children nodes is constructed, each of which is a 
  <emph>Node</emph>.  The constructor 
  <emph>document-node</emph> constructs the document node in the 
  data model.</p>

  <p role="definition">
  sequence-map : ((<emph>UnitValue1</emph> -> <emph>UnitValue2</emph>), Sequence&lt;<emph>UnitValue1</emph>) 
               -> Sequence&lt;<emph>UnitValue2</emph>&gt;</p>

  <p>The <emph>dm-node</emph> function maps an information item 
  to a sequence of zero or one data-model node.</p>
  
  <p id="dm-node" role="definition">
  dm-node : <loc href="#InfoItem">InfoItem</loc> -> Sequence&lt;(0,1)Node&gt;
  function dm-node(i) { 
    return
      if (infoitem-kind(i) = "element") then 
        <loc href="#dm-element-node">dm-element-node</loc>(i)
      else if (infoitem-kind(i) = "character") then 
        <loc href="#dm-char-to-text">dm-char-to-text</loc>(i)
      else if (infoitem-kind(i) = "processing-instruction") then {
        if (not(ignore-processing-instructions)) then 
          <loc href="#dm-pi-node">dm-pi-node</loc>(i)
        else empty-sequence()
      }
      else if (infoitem-kind(i) = "comment") {
        if (not(ignore-comments)) then 
          <loc href="#dm-comment-node">dm-comment-node</loc>(i)
        else empty-sequence()
      }
      else if (infoitem-kind(i) = "doctype") then 
        empty-sequence()
      else if (infoitem-kind(i) = "notation-item") then 
        empty-sequence()
      else if (infoitem-kind(i) = "unparsed-entity-item") then 
        empty-sequence()
  }
  </p>
</div2>

<div2 id="ElementNode">
  <head>Elements</head>

  <p>Each element node corresponds to an <emph role="info-item">element 
  information item</emph>.</p>

  <p>An element node has an <emph>expanded-QName</emph>.  The local part
  of the <emph>expanded-QName</emph> corresponds to the 
  <emph role="infoset-property">local name</emph> property.  
  The namespace name of the <emph>expanded-QName</emph> of the element node
  corresponds to the <emph role="infoset-property">namespace name</emph>
  property, if it has a value.</p>
  
  <p>The <emph>children</emph> nodes of the element node 
  correspond to the element, comment, processing instruction, and
  character information items appearing in the
  <emph role="infoset-property">children</emph> property.
  This correspondence is not one-to-one, as consecutive
  <emph role="info-item">character information item</emph> children
  are coalesced into a single text node.  Because the data model requires 
  that all general entities be expanded, there will never be 
  <emph role="info-item">unexpanded entity reference information item</emph> 
  children.</p>

  <p>The <emph>attributes</emph> of the element node are nodes
  corresponding to <emph role="info-item">attribute information 
  items</emph> appearing in the 
  <emph role="infoset-property">attributes</emph> property.  The 
  attributes of an element always have distinct names.</p>

  <p>The <emph>namespaces</emph> of the element node are nodes
  corresponding to <emph role="info-item">namespace information items</emph>
  appearing in the <emph role="infoset-property">in-scope namespaces</emph>
  property.  The namespaces of an element always have distinct prefixes.</p>

  <p>The <emph>declaration</emph> of an element is a schema component
  and corresponds to the <emph role="infoset-property">element
  declaration</emph> PSVI property.  The <emph>type</emph> of an
  element is a schema component and corresponds to the <emph
  role="infoset-property">type definition</emph> PSVI property.  The
  representation of schema component information is defined in
  <specref ref="types"/>.
  </p>

  <p>An element node has an associated simple
  <emph>typed-value</emph>, e.g., an integer,
  date, or user-defined simple value.  For a document with a
  schema, the element's typed-value corresponds to the <emph
  role="infoset-property">schema normalized value</emph> PSVI
  property.  If the element has a complex type, the typed-value is the
  empty sequence. For an element in a well-formed document with no
  associated schema, the element's typed-value is the empty
  sequence.</p>

<!--   <ednote><edtext>JM: Prose seems to indicate value nodes, formalism 
  doesn't.</edtext></ednote> -->

<!--  <ednote><edtext>JM: Or type can be determined by the [type definition name] 
  and associated properties.</edtext></ednote> -->

<!--   <p>An element node may have a unique identifier (ID). This is the value 
  of the attribute that is declared in the DTD as type ID. No two elements 
  in a document may have the same unique ID.</p> -->

  <p>The <emph>unique ID</emph> of the element node corresponds to the 
  <emph role="infoset-property">normalized value</emph> property 
  of the <emph role="info-item">attribute information item</emph>
  in the <emph role="infoset-property">attributes</emph> 
  property that has a type <emph>ID</emph>.</p>

  <ednote><edtext>JM: Need to augment attribute typing to accommodate DTD types
  and Schema types in a unified manner.  For instance, what is the namespace of
  the ID type from a DTD?</edtext></ednote>
  
  <ednote><edtext>JM: Not incorporated from XPath 1.0: "If an XML processor 
  reports two elements in a document as having the same unique ID (which is 
  possible only if the document is invalid) then the second element in 
  document order must be treated as not having a unique ID."</edtext></ednote>

  <p>The <emph>parent</emph> of the element node corresponds to the node
  corresponding to the <emph role="infoset-property">parent</emph> property.</p>

  <p>The <emph>string-value</emph> of an element node is the concatenation of 
  the string-values of all text-node descendants of the element node in 
  document order.</p>

<p  id="element-node">
  An element node has a constructor <emph>element-node</emph>,
  which takes an expanded-QName, a sequence of namespace nodes, a sequence
  of attribute nodes, a sequence of child nodes, and 
  the node's element declaration, which is a schema component.  
  Like all other node constructors, the element-node
  constructor has the effect of creating a new node with a unique identity, 
  distinct from all other nodes.</p>
  
  <p role="definition">
  element-node : (<loc href="#value">expanded-QName</loc>, 
                  Sequence&lt;<loc href="#NamespaceNode">NamespaceNode</loc>&gt;,
                  Sequence&lt;<loc href="#AttributeNode">AttributeNode</loc>&gt;, 
                  Sequence&lt;<loc href="#ElementNode">ElementNode</loc> | <loc href="#TextNode">TextNode</loc> | <loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc> 
                          | <loc href="#CommentNode">CommentNode</loc> | <loc href="#ReferenceNode">ReferenceNode</loc>&gt;, 
                  <loc href="#SchemaComponent">SchemaComponent</loc>)
               -> <loc href="#ElementNode">ElementNode</loc>
  </p>
<ednote><edtext>MF: The constructor only takes the element 
declaration, because it's possible to derive
the type of an element or attribute from its corresponding
declaration.  But would it be cleaner to include the type in the
constructor as well?
</edtext></ednote>

<p>To guarantee that the parent-child relationship is 
  invertible, the element constructor logically creates a copy of all of its 
  namespace, attribute, and children arguments and sets the parent property 
  of these nodes to the newly created element node. As long as the parent-child 
  constraint is satisfied, an implementation of the data model may choose to 
  use specialized techniques to avoid creating physical copies of the 
  arguments to an element constructor.</p>
  
  <ednote><edtext>MF: An alternative interface is suggested by James Clark:
  See <specref ref="Issue-0019"/>.</edtext></ednote>

  <p>The accessors <emph>name</emph>,
  <emph>namespaces</emph>, <emph>attributes</emph>,
  <emph>children</emph>, and <emph>declaration</emph> return an
  element node's constituent parts.  The <emph>type</emph>
  accessor returns the schema component corresponding to the type of
  the element's content: either a complex-type-definition or
  simple-type-definition.  It is possible to derive the element's type
  from its declaration.
</p>
  
  <p role="definition">
name       : <loc href="#ElementNode">ElementNode</loc> -> <loc href="#value">expanded-QName</loc>
namespaces : <loc href="#ElementNode">ElementNode</loc> -> Sequence&lt;<loc href="#namespace-node">NamespaceNode</loc>&gt;
attributes : <loc href="#ElementNode">ElementNode</loc> -> Sequence&lt;<loc href="#AttributeNode">AttributeNode</loc>&gt;
children   : <loc href="#ElementNode">ElementNode</loc> 
           -> Sequence&lt;<loc href="#ElementNode">ElementNode</loc> | <loc href="#text-node">TextNode</loc> | <loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc> 
                      | <loc href="#comment-node">CommentNode</loc> | <loc href="#ReferenceNode">ReferenceNode</loc>&gt; 
declaration : <loc href="#ElementNode">ElementNode</loc> -> <loc href="#SchemaComponent">SchemaComponent</loc>
type        : <loc href="#ElementNode">ElementNode</loc> -> <loc href="#SchemaComponent">SchemaComponent</loc>
  </p>

    <p>The accessor function <emph>typed-value</emph> returns 
    a sequence of the simple-typed values of an element, if the
    element has a simple type, otherwise if the
    element has a complex type, it returns the empty sequence.</p>
    
    <p role="definition">
typed-value : ElementNode -> Sequence&lt;SimpleValue&gt;
    </p>

    <p>The accessor function <emph>unique-id</emph> returns 
    a sequence containing the unique ID of a node, if one exists,
    otherwise, it returns the empty sequence. </p>
    
    <p role="definition">
unique-id : ElementNode -> Sequence(0,1)&lt;xs:ID&gt;
    </p>

  <p >The node accessors
  <emph>node</emph>, <emph>node-kind</emph>, 
<emph>parent</emph>, and <emph>string-value</emph> also apply to
  element nodes.
</p>

  <p>An element node is constructed from an Element Information
  Item by the <emph>dm-element-node</emph> function:</p>

  <p role="definition" id="ElementItem">
/* Accessors for element information items: */
infoset-elem-namespace-name : <loc href="#ElementItem">ElementItem</loc> -> Sequence(0,1)&lt;<loc href="#primvalue">xs:anyURI</loc>&gt;
infoset-elem-local-name     : <loc href="#ElementItem">ElementItem</loc> -> <loc href="#primvalue">xs:string</loc>
infoset-elem-children       : <loc href="#ElementItem">ElementItem</loc> -> Sequence&lt;<loc href="#InfoItem">InfoItem</loc>&gt;
infoset-elem-attributes     : <loc href="#ElementItem">ElementItem</loc> -> Sequence&lt;<loc href="#AttributeItem">AttributeItem</loc>&gt;
infoset-elem-in-scope-namespaces  : <loc href="#ElementItem">ElementItem</loc> -> Sequence&lt;<loc href="#NamespaceItem">NamespaceItem</loc>&gt;
infoset-elem-base-URI       : <loc href="#ElementItem">ElementItem</loc> -> <loc href="#primvalue">xs:anyURI</loc>  /* unused ? */

psvi-elem-validity            : <loc href="#ElementItem">ElementItem</loc> -> xs:string
psvi-elem-element-declaration : <loc href="#ElementItem">ElementItem</loc> -> <loc href="#ElementItem">ElementItem</loc>
psvi-elem-type-definition     : <loc href="#ElementItem">ElementItem</loc> -> <loc href="#ElementItem">ElementItem</loc>
psvi-elem-schema-normalized-value : <loc href="#ElementItem">ElementItem</loc> -> <loc href="#primvalue">xs:string</loc>
  </p>

  <p id="dm-element-node" role="definition">
dm-element-node : <loc href="#ElementItem">ElementItem</loc> -> <loc href="#ElementNode">ElementNode</loc>
function dm-element-node(e) { 
  name       = <loc href="#primvalue">xfo:expanded-QName</loc>(infoset-elem-namespace-name(e), 
                                infoset-elem-local-name(e))
  nsnodes    = sequence-map(<loc href="#dm-namespace-node">dm-namespace-node</loc>, 
                            infoset-elem-in-scope-namespaces(e))
  attrnodes  = sequence-map(<loc href="#dm-attribute-node">dm-attribute-node</loc>, infoset-elem-attributes(e))
  kids       = <loc href="#dm-collapse-text-nodes">dm-collapse-text-nodes</loc>(sequence-map(<loc href="#dm-node">dm-node</loc>, infoset-elem-children(e)))

  declaration = dm-schema-component(psvi-elem-validity(e), 
                                    psvi-elem-element-declaration(e))
  type        = dm-schema-component(psvi-elem-validity(e), 
                                    psvi-elem-type-definition(e))
  return <loc href="#element-node">element-node</loc>(name, nsnodes, attrnodes, kids, declaration)
}</p>

  <ednote><edtext>MF: Even though its possible to derive
  the type of an element from its corresponding element declaration,
  it seems cleaner to compute explicitly the schema components for
  both the element declaration and its simple or complex type.</edtext></ednote>

  <ednote><edtext>JM: Why is [base URI] discarded?  <specref ref="Issue-0030"/>.</edtext></ednote>

  <ednote><edtext>JM: Update the above to accomodate the possibility of
  schema-less and DTD validation.</edtext></ednote>
<!--
  <ednote><edtext>MF: There now exists a normalized Schema value that
  contains the value of an element(attribute)'s
  simple-typed value.  This value should be used to compute an
  element(attribute)'s <emph>typed-value</emph>.
  </edtext></ednote>
-->

<!--
  <p role="definition" id="dm-concat-string">
  /* The <emph>dm-concat-string</emph> function concatenates two strings */
  concat-string : (string, string) -> string
  </p>
-->
</div2>

<div2 id="AttributeNode">
  <head>Attributes</head>

  <p>Each element node has an associated set of attribute nodes, each
  corresponding to an <emph role="info-item">attribute 
  information item</emph>.</p>
  
  <p>An attribute node has an <emph>expanded-QName</emph>.  The local part 
  of the <emph>expanded-QName</emph> corresponds to the 
  <emph role="infoset-property">local name</emph> property. The namespace 
  name of the <emph>expanded-QName</emph> corresponds to the 
  <emph role="infoset-property">namespace name</emph> property.</p>

  <p>An attribute node has an associated <emph>string-value</emph>,
  which corresponds to the
  <emph role="infoset-property">normalized value</emph> property.</p>

  <p>The <emph>declaration</emph> of an attribute is a schema component
  and corresponds to the <emph role="infoset-property">attribute
  declaration</emph> PSVI property.  The <emph>type</emph> of an
  attribute is a schema component and corresponds to the <emph
  role="infoset-property">type definition</emph> PSVI property.  The
  representation of schema component information is defined in
  <specref ref="types"/>.
  </p>

  <p>An attribute node also has a <emph>typed-value</emph>.  For a
  document with a schema, the attribute's typed-value corresponds to
  the <emph role="infoset-property">schema normalized value</emph>
  PSVI property.  For an attribute in a well-formed document with no
  associated schema, the attribute's typed-value is the empty
  sequence.
  </p>

  <ednote><edtext>JM: What about in the presence of a DTD?  We need to 
  recognize ID attribute types at a minimum.</edtext></ednote>

<!--  <ednote><edtext>JM: string-value of value nodes needs to be -->
<!--  defined (elsewhere?)</edtext></ednote> -->

  <p>For convenience, the element node is called the "parent" of each of 
  these attribute nodes even though an attribute node is not a "child" of 
  its parent element.  The <emph>parent</emph> of the attribute node 
  corresponds to the <emph role="infoset-property">owner element</emph> 
  property.</p>

<p id="attribute-node">
  An attribute node has the constructor <emph>attribute-node</emph>, 
  which takes the attribute's name, a string value, and the node's
  attribute declaration, which is a schema component.
Like all other node constructors, the attribute-node
  constructor has the effect of creating a new node with a unique identity, 
  distinct from all other nodes.  </p>

  <p role="definition">
attribute-node : (<loc href="#value">xs:QName</loc>, <loc href="#primvalue">xs:string</loc>, <loc href="#SchemaComponent">SchemaComponent</loc>) -> <loc href="#AttributeNode">AttributeNode</loc></p>
  
  <p>The accessors <emph>name</emph> and
  <emph>declaration</emph> return an
  attribute's constituent parts. The accesor <emph>string-value</emph>
  returns its value. The <emph>type</emph> accessor
  returns the schema component corresponding to the simple type of the
  attribute's value.  It is possible to derive the attribute's type
  from its declaration.
</p>

  <p role="definition">
name        : <loc href="#AttributeNode">AttributeNode</loc> -> <loc href="#primvalue">xs:QName</loc>
declaration : <loc href="#AttributeNode">AttributeNode</loc> -> <loc href="#SchemaComponent">SchemaComponent</loc>
type        : <loc href="#AttributeNode">AttributeNode</loc> -> <loc href="#SchemaComponent">SchemaComponent</loc></p>
<!-- value       : <loc href="#AttributeNode">AttributeNode</loc> -> <loc href="#primvalue">xs:string</loc>-->

    <p>The accessor function <emph>typed-value</emph> returns 
    a sequence of the simple-typed values of an attribute.</p>
    
    <p role="definition">
typed-value : AttributeNode -> Sequence&lt;SimpleValue&gt;</p>

  <p>The node accessors
  <emph>node-kind</emph>, <emph>parent</emph>, and <emph>string-value</emph> also apply to
  attribute nodes.
</p>

  <p >An attribute node is constructed from an Attribute Information
  Item by the <emph>dm-attribute-node</emph> function:</p>

  <p role="definition" id="AttributeItem">
/* Accessors for attribute information items: */
infoset-attr-namespace-name   : <loc href="#AttributeItem">AttributeItem</loc> -> Sequence(0,1)&lt;<loc href="#primvalue">xs:anyURI</loc>&gt;
infoset-attr-local-name       : <loc href="#AttributeItem">AttributeItem</loc> -> <loc href="#primvalue">xs:string</loc>
infoset-attr-normalized-value : <loc href="#AttributeItem">AttributeItem</loc> -> <loc href="#primvalue">xs:string</loc>
infoset-attr-owner-element    : <loc href="#AttributeItem">AttributeItem</loc> -> <loc href="#ElementItem">ElementItem</loc>

psvi-attr-validity            : <loc href="#AttributeItem">AttributeItem</loc> -> xs:string
psvi-attr-attribute-declaration : <loc href="#AttributeItem">AttributeItem</loc> -> <loc href="#ElementItem">ElementItem</loc>
psvi-attr-type-definition     : <loc href="#AttributeItem">AttributeItem</loc> -> <loc href="#ElementItem">ElementItem</loc>
psvi-attr-schema-normalized-value : <loc href="#AttributeItem">AttributeItem</loc> -> <loc href="#primvalue">xs:string</loc>
  </p>

<!--   <p role="infoset">Although it's possible to derive
the type of an attribute from its corresponding attribute declaration,
it seems cleaner to compute explicitly the schema components for
both the attribute declaration and its simple type.</p> -->

  <p role="definition" id="dm-attribute-node">
dm-attribute-node : <loc href="#AttributeItem">AttributeItem</loc> -> <loc href="#AttributeNode">AttributeNode</loc> 
function dm-attribute-node(a) {
   name = xfo:expanded-QName(infoset-attr-namespace-name(a), 
                             infoset-attr-local-name(a))
   declaration = dm-schema-component(psvi-attr-validity(a), 
                                     psvi-attr-attribute-declaration(a))
   type = dm-schema-component(psvi-attr-validity(a), 
                              psvi-attr-type-definition(a))
   return <loc href="#attribute-node">attribute-node</loc>(name, infoset-attr-normalized-value(a), declaration)
}
  </p>

  <ednote><edtext>JM: Update the above to accomodate the possibility of
  schema-less and DTD validation.</edtext></ednote>

</div2>

<div2 id="NamespaceNode">
<head>Namespaces</head>

  <p>Each element node has an associated set of namespace nodes, each
  corresponding to a <emph role="info-item">namespace information item</emph>.</p>
  
  <p>A namespace node has an <emph>expanded-QName</emph>.  The local part of the 
  <emph>QName</emph> corresponds to the <emph role="infoset-property">prefix</emph> 
  property.  The namespace name of the <emph>QName</emph> is the empty
  sequence.</p>

  <p>The <emph>string-value</emph> of the namespace node corresponds to 
  the <emph role="infoset-property">namespace URI</emph> property.</p>

  <p>A namespace node has no <emph>parent</emph>.</p>

  <ednote><edtext>From XPath 1.0 : "The <emph>parent</emph> of the
  namespace node is the element node in whose namespaces collection
  this node appears."  This is still the subject of debate.
  </edtext></ednote>

<p id="namespace-node">
  A namespace node has the constructor
  <emph>namespace-node</emph>, which takes a namespace prefix and 
  the absolute URI of the namespace being declared, either of which
  may be the empty sequence.  If the URI is empty, the prefix must 
  be empty too.
  Like all other node constructors, the namespace node
  constructor has the effect of creating a new node with a unique identity, 
  distinct from all other nodes.  </p>

  <p role="definition">
namespace-node : (Sequence(0,1)&lt;<loc href="#primvalue">xs:string</loc>&gt;, Sequence(0,1)&lt;<loc href="#primvalue">xs:anyURI</loc>&gt;) 
              -> <loc href="#NamespaceNode">NamespaceNode</loc></p>

<!-- 
  <p>The accessor <emph>name</emph> returns a
  namespace's QName:</p>
  
  <p role="definition">
name : <loc href="#NamespaceNode">NamespaceNode</loc> -> Sequence(0,1)&lt;<loc href="#primvalue">xs:QName</loc>&gt;
  </p>
--> 
<p>
The accessors <emph>prefix</emph> and <emph>namespace-uri</emph>
return a namespace node's constituent parts:</p>
<p role="definition">
prefix : <loc href="#NamespaceNode">NamespaceNode</loc> -> Sequence(0,1)&lt;<loc href="#primvalue">xs:string</loc>&gt;
uri    : <loc href="#NamespaceNode">NamespaceNode</loc> -> Sequence(0,1)&lt;<loc href="#primvalue">xs:anyURI</loc>&gt;
</p>

  <p>The accessors
  <emph>name</emph>, <emph>node-kind</emph> and <emph>string-value</emph> also apply to
  comment nodes.
The <emph>parent</emph> accessor applied to a namespace-node returns
  the empty sequence:
</p>
<p role="definition">
parent(NamespaceNode) : Sequence(0,0)&lt;ElementNode | DocumentNode&gt;</p>

  <p>A namespace node is constructed from a Namespace Information
  Item by the <emph>dm-namespace-node</emph> function:</p>

  <p role="definition" id="NamespaceItem">
infoset-ns-prefix           : <loc href="#NamespaceItem">NamespaceItem</loc> -> Sequence(0,1)&lt;<loc href="#primvalue">xs:string</loc>&gt;
infoset-ns-namespace-name   : <loc href="#NamespaceItem">NamespaceItem</loc> -> Sequence(0,1)&lt;<loc href="#primvalue">xs:anyURI</loc>&gt;
  </p>

  <p role="definition" id="dm-namespace-node">
dm-namespace-node : <loc href="#NamespaceItem">NamespaceItem</loc> -> <loc href="#NamespaceNode">NamespaceNode</loc> 
function dm-namespace-node(i) {
   return <loc href="#NamespaceNode">namespace-node</loc>(infoset-ns-prefix(i), infoset-ns-namespace-name(i))
}</p>
</div2>

<div2 id="ProcessingInstructionNode">
  <head>Processing Instructions</head>

  <p>A processing instruction node corresponds to a <emph role="info-item">processing
  instruction information item</emph>.  There are no processing instruction 
  nodes for processing instructions that are children of a 
  <emph role="info-item">document type declaration information item</emph>.</p>
  
  <p>A processing instruction node has an <emph>expanded-QName</emph>. The local part of the 
  <emph>expanded-QName</emph> corresponds to the <emph role="infoset-property">target</emph>
  property.  The namespace name of the <emph>expanded-QName</emph> is
  the empty sequence.
  The local part is a string value that must be an NCName.
</p>
<p>
  The string '?&gt;' may not occur within a processing instruction's
  target value (<bibref ref="xml-rec"/>).</p>

  <p>The <emph>string-value</emph> of the processing instruction node 
  corresponds to the <emph role="infoset-property">content</emph> 
  property.</p>

  <p>The <emph>parent</emph> of the processing instruction node 
  corresponds to the <emph role="infoset-property">parent</emph> 
  property.</p>


  <p id="processing-instruction-node">
  A processing-instruction node has the constructor
  <emph>processing-instruction-node</emph>, which takes a string
  representing the target and a string representing the content.  Like
  all other node constructors, the processing node constructor has the
  effect of creating a new node with a unique identity, distinct from
  all other nodes.  </p>
  
  <p>The <emph>string-value</emph> of the processing-instruction node corresponds to 
  the <emph role="infoset-property">content</emph> property.</p>
  
  <p role="definition">
processing-instruction-node : (<loc href="#primvalue">xs:NCName</loc>, <loc href="#primvalue">xs:string</loc>)
                            -> <loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc>
  </p>
  
  <p>The node accessors
  <emph>name</emph>, <emph>node-kind</emph>, <emph>parent</emph>, and <emph>string-value</emph> also apply to
  processing-instruction nodes.
</p>

  <p>A processing-instruction node is constructed from an Processing
  Instruction Information Item by the <emph>dm-pi-node</emph> function:</p>

  <p role="definition" id="ProcessingInstructionItem">
/* Accessors for processing instruction information items */
infoset-pi-target  : <loc href="#ProcessingInstructionItem">ProcessingInstructionItem</loc> -> <loc href="#primvalue">xs:string</loc>
infoset-pi-content : <loc href="#ProcessingInstructionItem">ProcessingInstructionItem</loc> -> <loc href="#primvalue">xs:string</loc>
</p>

  <p role="definition" id="dm-pi-node">
dm-pi-node : <loc href="#ProcessingInstructionItem">ProcessingInstructionItem</loc> -> <loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc> 
function dm-pi-node(i) {
  return processing-instruction-node(xfo:NCName(infoset-pi-target(i)), 
                                     infoset-pi-content(i))
}</p>
</div2>

<div2 id="CommentNode">
  <head>Comments</head>
  
  <p>A comment node corresponds to a <emph role="info-item">comment 
  information item</emph>.  There are no comment nodes for comments
  that are children of a <emph role="info-item">document type declaration
  information item</emph>.</p>
  
  <p>A comment node does not have an <emph>expanded-QName</emph>.</p> 

  <p>The <emph>string-value</emph> of the comment node corresponds to 
  the <emph role="infoset-property">content</emph> property.</p>
  
  <p>The <emph>parent</emph> of the comment node 
  corresponds to the <emph role="infoset-property">parent</emph> 
  property.</p>

  <p>The string "--" (double-hyphen) must not occur within a comment's
  string value (<bibref ref="xml-rec"/>).</p>
  
<p id="comment-node">
  A comment node has the constructor
  <emph>comment-node</emph>, which takes a string value.
Like all other node constructors, the comment node
  constructor has the effect of creating a new node with a unique identity, 
  distinct from all other nodes.  </p>
  
  <p role="definition">
comment-node : <loc href="#primvalue">xs:string</loc> -> <loc href="#CommentNode">CommentNode</loc></p>

<!--  
  <p  role="infoset">The accessor <emph>content</emph> returns a <code>CommentNode</code>'s content.</p>
  
  <p role="definition">
content    : <loc href="#CommentNode">CommentNode</loc> -> <loc href="#primvalue">xs:string</loc>
  </p>
-->

  <p>The node accessors
  <emph>node-kind</emph>, <emph>parent</emph>, and <emph>string-value</emph> also apply to
  comment nodes.
  A comment node does not have an expanded-QName; the following
  signature specifies that <emph>name</emph> applied to a comment
  node returns the empty sequence:
  </p>
  <p role="definition">
name(CommentNode) : Sequence(0,0)&lt;xs:QName&gt;</p>

  <p>A comment node is constructed from a Comment Information 
  Item by the <emph>dm-comment-node</emph> function:</p>

  <p role="definition" id="CommentItem">
/* Accessors for comment information items */
infoset-comment-value    : <loc href="#CommentItem">CommentItem</loc> -> <loc href="#primvalue">xs:string</loc>
</p>

<!--  infoset-comment-parent   : <loc href="#CommentItem">CommentItem</loc> -> <loc href="#ElementItem">ElementItem</loc> | <loc href="#DocumentItem">DocumentItem</loc>  /* unused ? */
-->  

<p role="definition" id="dm-comment-node">
dm-comment-node : <loc href="#CommentItem">CommentItem</loc> -> <loc href="#comment-node">CommentNode</loc> 
function dm-comment-node(i) {
  return  <loc href="#CommentNode">comment-node</loc>(infoset-comment-value i)
}
</p>
</div2>

<div2 id="ReferenceNode">
  <head>References</head>

  <p>The data model provides reference nodes as a general mechanism
  for referring to arbitrary nodes and preserving their identity.
  <!-- encapsulate the identity of nodes. --></p>
  
  <p>We assume that the representation of a reference node is defined by the
  query system that implements the data model.
<!--, not by the XSLT, XQuery,  or XPath languages themselves.  -->
  The mechanism for implementing
  a reference node is implementation dependent, for example, 
  a reference node might be represented by a ID or key value, an object
  identifier, an XPointer value <bibref ref="xpointer"/>, etc.  Node references are not serialized, i.e., 
  they exist only for use by the query system. To serialize a node reference, 
  an implementation may require that the reference be transformed
  explicitly to a valid 
  XML value, such as an IDREF or URI reference, or the implementation may 
  transform a reference node automatically.</p>

  <p>Reference nodes are not guaranteed to be globally unique or persistent, 
  although some implementation of the data model may choose to support
  persistent node references. Multiple techniques may exist for implementing 
  reference nodes, and there may be multiple techniques for implementing node 
  identity.</p>

  <p>A reference node does not correspond to any information item.</p>

  <p>A reference node does not have an <emph>expanded-QName</emph>.</p> 

  <p>The <emph>string-value</emph> of a reference node is implementation-defined.</p>
  
  <p id="reference-node">A reference node has the constructor <emph>reference-node</emph>, 
  which takes a document, element, attribute, text, processing-instruction, 
  or comment node.  Like all other node constructors, the reference node
  constructor has the effect of creating a new node with a unique identity, 
  distinct from all other nodes.</p>

  <p role="definition">
  reference-node : (<loc href="#DocumentNode">DocumentNode</loc> | <loc href="#ElementNode">ElementNode</loc> | <loc href="#AttributeNode">AttributeNode</loc> | <loc href="#TextNode">TextNode</loc> 
                  | <loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc> | <loc href="#CommentNode">CommentNode</loc>)
                -> <loc href="#ReferenceNode">ReferenceNode</loc></p>

  <p>The accessor <emph>dereference</emph> returns the node referred to by a 
  reference node.</p>

  <p role="definition">
  dereference   : <loc href="#ReferenceNode">ReferenceNode</loc> 
                -> (<loc href="#DocumentNode">DocumentNode</loc> | <loc href="#ElementNode">ElementNode</loc> | <loc href="#AttributeNode">AttributeNode</loc> | <loc href="#TextNode">TextNode</loc> 
                  | <loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc> | <loc href="#CommentNode">CommentNode</loc>)</p>

  <p>The node accessors <emph>node-kind</emph>, <emph>parent</emph>, and 
  <emph>string-value</emph> also apply to reference nodes. The following
  signature specifies that <emph>name</emph> applied to a reference node
  node returns the empty sequence:</p>
  
  <p role="definition">
name(ReferenceNode) : Sequence(0,0)&lt;xs:QName&gt;</p>


</div2>

<div2 id="TextNode">
  <head>Text</head>

  <p>A text node corresponds to a sequence of one or more consecutive
  <emph role="info-item">character information items</emph>.  As much 
  character data as possible is grouped into each text node: a text node 
  never has an immediately following or preceding sibling that is a 
  text node.</p>

  <p>A text node does not have an <emph>expanded-QName</emph>.</p> 

  <p>The <emph>string-value</emph> of a text node is the character data,
  which corresponds to the concatenated <emph role="infoset-property">character 
  code</emph> properties of each of the <emph role="info-item">character 
  information items</emph>.</p>

  <p>The <emph>parent</emph> of the text node corresponds to 
  the <emph role="infoset-property">parent</emph> property of 
  any one of the consecutive <emph role="info-item">character 
  information items</emph> (consecutive characters always have 
  the same parent).</p>

  <p id="text-node">A text node has the constructor <code>text-node</code>
  and takes a string value.  Like all other node constructors, the text
  constructor has the effect of creating a new node with a unique identity, 
  distinct from all other nodes.</p>

  <p>The <emph>string-value</emph> of a text node is simply its content.</p>

  <p role="definition">
text-node : <loc href="#primvalue">xs:string</loc> -> <loc href="#TextNode">TextNode</loc></p>

  <p>The node accessors
  <emph>node-kind</emph>, <emph>parent</emph>, and <emph>string-value</emph> also apply to
  text nodes.</p>

  <p>The mapping from character information items to
  text nodes occurs in the <loc href="#dm-element-node">dm-element-node</loc> function. 
  The <emph>infoset-char-code</emph> accessor maps a character
  information item
  to the ISO 10646 character code (in the range 0 to #x10FFFF, though not every
  value in this range is a legal XML character code) of the character. </p>

  <p role="definition" id="CharacterItem">
infoset-char-code       : <loc href="#CharacterItem">CharacterItem</loc> -> Code</p>

  <p>The function <emph>dm-char-to-text</emph> takes one character
  information item and maps it to a text node with a string value of 
  length one. </p>

  <p id="dm-char-to-text" role="definition">
  dm-char-to-text : <loc href="#CharacterItem">CharacterItem</loc> -> <loc href="#TextNode">TextNode</loc>
  function dm-char-to-text(c) {
    /* convert character code to string of length 1 */
    <loc href="#TextNode">text-node</loc>(code2string(infoset-char-code c))
  }</p>

  <p>The <emph>dm-collapse-text-node</emph> function synthesizes a single text 
  node from multiple text nodes. It calls <emph>dm-text-nodes</emph>
  to collapse recursively one or more consecutive text nodes in its argument 
  sequence.  If insignificant whitespace is ignored, any text node containing 
  only whitespace is eliminated. All other nodes  are returned unchanged.</p>

  <p id="dm-collapse-text-nodes" role="definition">
  dm-collapse-text-nodes : Sequence&lt;Node&gt; -> Sequence&lt;Node&gt; 
  dm-text-node           : Sequence&lt;Node&gt; -> Sequence&lt;Node&gt; 

  function dm-collapse-text-node(nodes) {
    let newnodes := dm-text-nodes(nodes)
    return 
      if (ignore-whitespace) then 
        sequence-map(delete-whitespace-node, newnodes)
      else newnodes
  }

  function dm-text-nodes(nodes) {
    if (empty(nodes)) then empty-sequence()
    else 
      let h := head(nodes), 
          t := tail(nodes)
      return 
        if (node-kind(h) = "text") then {
          /* Collapse two consecutive text nodes and apply 
             dm-text-nodes recursively */
          if (empty(t)) then h
          else if (node-kind(head(t)) = "text") then 
             dm-text-nodes(
               append(
                 text-node(xfo:concat(string-value(h), string-value(head(t))), 
                 tail(t)))
        }
        else append(h, dm-text-nodes(t))
  }</p>
<!--  infoset-char-parent     : <loc href="#CharacterItem">CharacterItem</loc> -> Sequence&lt;<loc href="#ElementItem">ElementItem</loc>&gt; /* unused */
  infoset-char-whitespace : <loc href="#CharacterItem">CharacterItem</loc> -> <loc href="#primvalue">xs:boolean</loc> /* unused */
-->  
</div2>
</div1>

<div1 id="simplevalues">
  <head>Simple Values</head>

  <p>This section specifies how to construct and access simple values.</p>

  <div2 id="primvalue">
    <head>Primitive Values</head>

    <p>A <emph>primitive value</emph> is a value contained in the
    union of the value spaces of the nineteen primitive XML
    Schema data types <bibref ref="xmlschema-2"/>.  They are named:
    <emph>xs:string</emph>, <emph>xs:boolean</emph>,
    <emph>xs:decimal</emph>, <emph>xs:float </emph>,
    <emph>xs:double</emph>, <emph>xs:duration</emph>,
    <emph>xs:dateTime</emph>, <emph>xs:time </emph>,
    <emph>xs:date</emph>, <emph>xs:gYearMonth</emph>,
    <emph>xs:gYear</emph>, <emph>xs:gMonthDay </emph>,
    <emph>xs:gDay</emph>, <emph>xs:gMonth</emph>,
    <emph>xs:hexbinary</emph>, <emph>xs:base64Binary </emph>,
    <emph>xs:anyURI</emph>, <emph>xs:QName</emph>,
    <emph>xs:NOTATION</emph>.
    </p>

<!--    
    <p role="definition">
PrimitiveValue = xs:string   | xs:boolean      | xs:decimal     | xs:float
               | xs:double   | xs:duration     | xs:dateTime    | xs:time  
               | xs:date     | xs:gYearMonth   | xs:gYear       | xs:gMonthDay
               | xs:gDay     | xs:gMonth       | xs:hexbinary   | xs:base64Binary
               | xs:anyURI   | xs:QName        | xs:NOTATION
    </p>
-->

<p>Constructors for primitive values are specified in a forthcoming
document that defines the functions and operators for XQuery and XPath
2.0.
Each constructor takes a string in the lexical space
of the given primitive type and returns a value in the value space of
the type.  For example, the constructor
<code>xfo:integer(xfo:string)</code> constructs an <code>xs:integer</code>
value from a string.
Analogous constructors exist for the other primitive types above. 
</p>

    <p>
Two primitive values <emph>xs:IDREF</emph> and <emph>xs:anyURI</emph>
have special accessors. 
The function <emph>id</emph> returns the element node denoted
by an <emph>xs:IDREF</emph> value:</p>
    
    <p role="definition">
id  : <loc href="#primvalue">xs:IDREF</loc> -> <loc href="#ElementNode">ElementNode</loc></p>
    
    <p id="referent" >Similarly, the function <emph>referent</emph> returns a sequence of element nodes 
    denoted by a <emph>xs:anyURI</emph>:</p>
    
    <p role="definition">
referent  : <loc href="#primvalue">xs:anyURI</loc> -> Sequence(0,1)&lt;<loc href="#ElementNode">ElementNode</loc>&gt;</p>
    
    <p>If a referent does not correspond to an element node in the data-model,
    <emph>referent</emph> returns the empty sequence, otherwise it returns a
    singleton sequence containing the referenced element node.
    In the data-model,
    every IDREF and keyref value is guaranteed to refer to a 
    <code>ElementNode</code>.
    This may not be the case for a URI reference value, which could refer to an
    element in an arbitrary document that is not contained in the data-model.
    In this case, <emph>referent</emph> may return the empty sequence.</p>
  </div2>
  <div2 id="value">
    <head>Derived Simple Values</head>

    <p>A derived simple value must be in the value space of 
its corresponding derived simple type.   A derived simple type has a 
primitive base type and a set of constraining facets. 
    For example, a "Sku" type is derived from string and has a
<emph>pattern</emph> facet:
:</p>
    
    <p role="definition">
&lt;simpleType name="Sku" base="string">
   &lt;pattern value="\d{3}-[A-Z]{2}"/> 
&lt;/simpleType></p>
    
  <p>A simple value has a corresponding <emph>type</emph>, which is a
  schema component</p>

<p>
A simple value has no identity.  Simple values only may be compared for
equality by value.
</p>
    <p>A simple value has the constructor
    <emph>simple-value</emph>, which takes a primitive value and the
simple value's type. </p>
    
    <p role="definition">
simple-value  : (<loc href="#primvalue">PrimitiveValue</loc>, <loc href="#SchemaComponent">SchemaComponent</loc>) -> <loc href="#value">SimpleValue</loc></p>
    
    <p>The accessor <emph>value</emph> returns
    a simple value's primitive value and <emph>type</emph>
    returns its type:</p>
    
    <p role="definition">
value  :  <loc href="#value">SimpleValue</loc> -> <loc href="#primvalue">PrimitiveValue</loc>
type   :  <loc href="#value">SimpleValue</loc> -> <loc href="#SchemaComponent">SchemaComponent</loc></p>
    
    <p>The accessor <emph>string-value</emph> returns
   the string representation of a simple value.  This
   function can be used to recover a lexical representation of a
   string value.  We note, however, that not all simple-typed values 
have a unique lexical representation (<specref ref="Issue-0027"/>).</p>
    
    <p role="definition">
string-value  :  <loc href="#value">SimpleValue</loc> -> <loc href="#primvalue">xs:string</loc></p>
    

    <p>Since the data model supports sequences, a value of a simple
    type derived by list can be represented as a sequence of the base
    type of the list simple type. </p>

    <p>
    Note that the data model does not currently represent
    key values and key reference values as described in XML Schema Part 1 : 
    Structures  <bibref ref="xmlschema-1"/>. In a future draft of this 
    document, keys and key references will be represented in the data 
    model (see <specref ref="Issue-0032"/>).
    </p>
  </div2>
  
<!-- 
  <div2 id="typevalues">
    <head>Accessing Simple Values of Elements and Attributes</head>

    <p>In the PSV Infoset, element and attribute nodes
    contain typed values.  An attribute contains a sequence
    of simple-typed values.  An element contains a complex-typed value,
    i.e., a sequence of nodes, or a sequence of simple 
    typed values.</p>

    <p>The accessor function <emph>typed-value</emph> returns 
    a sequence of the simple-typed values of an element or attribute.</p>
    
    <p role="definition">
typed-value : (ElementNode | AttributeNode) -> Sequence&lt;SimpleValue&gt;
    </p>
  </div2>
-->
</div1>

<div1 id="sequences">
  <head>Sequences</head>

  <p>The data model supports  
  a <emph>sequence</emph> collection.  Unlike conventional lists,
  sequences are "flat", i.e., sequences may not contain 
  other sequences.  Sequences may contain duplicate nodes and simple 
  values.</p>

  <p>A sequence has no identity.  Sequences only may be compared for
  equality by value.</p>

  <p>The <emph>string-value</emph> of a sequence is the concatenation of
  the <emph>string-value</emph>s of each member of the sequence.</p>

  <note>
    <p>Sequences replace the node-sets in XPath 1.0.
    In XPath 1.0, node-sets do not contain duplicates.  In 
    generalizing node-sets to sequences in XPath 2.0, duplicate removal 
    will be provided by functions on node sequences.</p>
  </note>
  
  <p>An important characteristic of the data model is there is no
  distinction between a unit value (i.e., a node or a simple value) and a singleton 
  sequence containing that value, i.e., a unit value is equivalent to a 
  singleton sequence containing that value and vice versa.</p>
  
  <p>The constructor <emph>empty-sequence</emph> constructs the empty sequence.
  The n-ary <emph>append</emph> constructor creates a new sequence containing
  the values in the its first argument followed by the appended values
  of its second through final arguments.  Since a unit value is equivalent to 
  a singleton sequence containing the unit value, <emph>append</emph> may be 
  applied to unit values.</p>
  
  <p role="definition">
  empty-sequence : Sequence&lt;<emph>UnitValue</emph>&gt;
  append         : (Sequence&lt;<emph>UnitValue</emph>&gt;, ..., Sequence&lt;<emph>UnitValue</emph>&gt;) -> Sequence&lt;<emph>UnitValue</emph>&gt;</p>  

  <p>A sequence has three accessors.  The <emph>empty</emph> accessor returns 
  true if its argument is the empty sequence and false otherwise. The 
  <emph>head</emph> accessor returns the first value in a non-empty sequence.
  The <emph>tail</emph> accessor returns all items in a non-empty
  sequence excluding its first member.</p>

  <p role="definition">
  empty : Sequence&lt;<emph>UnitValue</emph>&gt; -> xs:boolean
  head  : Sequence&lt;<emph>UnitValue</emph>&gt; -> <emph>UnitValue</emph>
  tail  : Sequence&lt;<emph>UnitValue</emph>&gt; -> Sequence&lt;<emph>UnitValue</emph>&gt;</p>
</div1>

<div1 id="error">
  <head>Error</head>

  <p>The data model includes a distinguished error value, called
  <emph>error</emph>.   Note that <emph>error</emph> cannot occur in the
  content of any node in the data model, nor may it occur in any
  sequence.  The error object is defined so that functions or operators 
  have a mechanism for identifying an error condition. 
  How the error value is handled in a query processor is
  implementation-defined.</p>
</div1>

<div1 id="types">
  <head>Schema Components</head>

  <p>This section requires some familiarity with the <bibref ref="XSFD"/>.
  In the data model, the <bibref ref="XSFD"/> (XFSD) components are 
  represented by four kinds of schema-component values:
  <emph>element-declaration</emph>,
  <emph>attribute-declaration</emph>,
  <emph>simple-type-definition</emph>, and 
  <emph>complex-type-definition</emph>.
  A <emph>schema component</emph> collectively refers to these four kinds
  of values.</p>

  <p>We use the notation <emph role="infoset-property">f</emph> 
  to refer to the XSFD component field named f.  
 The <emph role="infoset-property">name</emph> of an XSFD component has
  the form
  <emph>i</emph>#<emph>sn</emph><sub>1</sub>/.../<emph>sn</emph><sub>k</sub>,
  where 
  <emph>sn</emph><sub>k</sub> =
  <emph>ss</emph>::<emph>j</emph>.
The symbol <emph>i</emph> is a namespace, <emph>ss</emph> is one of six symbol
  spaces (element, attribute, type, attribute group, model group, or notation), and <emph>j</emph> is a local name. 
  Given an XSFD component with a <emph
  role="infoset-property">name</emph> as above, 
  the corresponding schema-component value has the following properties.</p>

  <p>A schema component has an <emph>expanded-QName</emph>
  The namespace name of its expanded-QName is equal to <emph>i</emph>, and 
  local part is equal to the empty string if <emph>j</emph> = *, otherwise 
  it is equal to <emph>j</emph>.</p>

  <p>The <emph>parent</emph> property is
  equal to the empty sequence if <emph>k</emph> = 1, otherwise
  it is the schema component with corresponding
  <emph role="infoset-property">name</emph> equal to 
  <emph>i</emph>#<emph>sn</emph><sub>1</sub>/.../<emph>sn</emph><sub>(k-1)</sub>.</p>

  <p>The <emph>base</emph>  property is
  the component whose name is <emph role="infoset-property">base</emph>.</p>

  <p>The <emph>derived-by-extension</emph> property 
  is true if <emph
  role="infoset-property">derivation</emph> is <emph>"extension"</emph>, otherwise false.</p>

  <p>The <emph>derived-by-refinement</emph> property 
  is true if <emph
  role="infoset-property">derivation</emph> is <emph>"restriction"</emph>, otherwise false.</p>

  <ednote><edtext>MF cite James: 
  (An alternative to (d), (e) and (f) would be to have an extends accessor
  that returns deref([base]) if [derivation] is extension and empty
  sequence otherwise, and a restricts accessor that returns deref([base])
  if [derivation] is restriction and empty sequence otherwise.)
  The [abstract], [refinement] and [content] fields of a XSFD component
  are not represented in this proposal (at least for the first two it
  would be easy to extend the proposal to cover them).
  </edtext></ednote>

  <p> A <emph>SchemaComponent</emph> has the following
  accessors.
  The <emph>component-kind</emph> accessor returns the string
  <emph>"element-declaration"</emph>, <emph>"attribute-declaration"</emph>,
  <emph>"simple-type-definition"</emph>, or
  <emph>"complex-type-definition"</emph>.
  The other accessors are defined above.</p>
  
<p role="definition" id="SchemaComponent">
component-kind        : SchemaComponent -> xs:string
name                  : SchemaComponent -> xs:QName
parent                : SchemaComponent -> Sequence(0,1)&lt;SchemaComponent&gt;
base                  : SchemaComponent -> SchemaComponent
derived-by-extension  : SchemaComponent -> xs:boolean
derived-by-refinement : SchemaComponent -> xs:boolean
</p>

<div2>
  <head>Mapping PSV Infoset additions to Schema Components</head>

  <p>This section specifies how 
  the schema component of an element or attribute 
  node is constructed from
  the PSV Infoset additions that specify
  validity and type assessment for the node's corresponding information
  item.</p>

  <p>We note that each kind of XSFD component has a corresponding
  "top-most" or "root"
  component, named <emph>xs:AnyElement</emph>, <emph>xs:AnyAttribute</emph>,
  <emph>xs:AnySimpleType</emph>, <emph>xs:AnyComplexType</emph>.
  These root components represent the most general element,
  attribute, simple type, and complex type.
  We assume these components are pre-defined and rely on them in the
  definitions below.</p>

  <p>A PSV element (attribute) information item has a 
  <emph role="infoset-property">validity</emph>, 
  an <emph role="infoset-property">element-declaration</emph>
  (<emph role="infoset-property">attribute-declaration</emph>), and
  a <emph role="infoset-property">type-definition</emph> property.
  The <emph role="infoset-property">validity</emph> property may be
  <emph>"valid"</emph>, <emph>"invalid"</emph>, or <emph>"notKnown"</emph>.
  The <emph role="infoset-property">element-declaration</emph>
  and <emph role="infoset-property">attribute-declaration</emph>
  properties contains an element information item that is
  isomorphic to the XML Schema element or attribute declaration of the 
  element or attribute information item.
  Similarly, 
  the <emph role="infoset-property">type-definition</emph>
  property contains an element information item that is
  isomorphic to the XML Schema type definition of the 
  element or attribute information item.
  These properties are used to construct the schema 
  component of an element or attribute in the data model.</p>

  <p>The <emph>dm-schema-component</emph> function
  takes a string-valued validity property and an element information item
  that corresponds to an element or attribute declaration or a type
  definition.  It constructs a schema-component value that
  corresponds to the schema component represented by its
  arguments. </p>

  <p id="dm-schema-component" role="definition">
  dm-schema-component : (xs:string, <loc href="#ElementItem">ElementItem</loc>) -> <loc href="#SchemaComponent">SchemaComponent</loc>
  </p>

  <p>If its <emph
  role="infoset-property">validity</emph> property is
  <emph>"valid"</emph>, <emph>dm-schema-component</emph> constructs a
  schema component that corresponds to the element or attribute
  declaration or type definition represented by the information item
  in its second argument.</p>

  <p>If its <emph
  role="infoset-property">validity</emph> property is
  <emph>"invalid"</emph> or <emph>"notKnown"</emph>,
  <emph>dm-schema-component</emph> returns the "root" schema component
  that corresponds to the element or attribute declaration or type
  definition represented by the information item in its second
  argument.  For example, if the information item is an element
  declaration, <emph>dm-schema-component</emph> returns
  <emph>xs:AnyElement</emph>, and similarly, for the other three
  components.  The only information that can be inferred from an
  invalid or not known validity value is that the information item is
  well-formed, therefore, we must associate the most general type
  information with the element or attribute node.</p>

  <ednote><edtext>MF:
  Following two cases need to be completed:
  </edtext></ednote>

  <p>Given information items that validate with respect to a DTD, ...
  </p>

  <p>Given information items from a document 
  a well-formed document, with no corresponding DTD or Schema...
  </p>

  <ednote><edtext>MF cite James' notes:
  Given an XSFD normalized attribute or element x[t types d], the
  declaration accessor would return deref(x) and the type accessor would
  return deref(t).

  Note that for any element or attribute node nd, if declaration(x) is not
  null, then

  local-name(x) = local-name(declaration(x)), and
  namespace-uri(x) = namespace-uri(declaration(x))
  </edtext></ednote>

</div2>
</div1>

<div1 id="functions">
  <head>Equality</head>
  <p>The functions and operators on data-model values
are included in a forthcoming
document that defines the functions and operators for XQuery 1.0 and 
XPath 2.0.  Included in that document are the functions that define
equality between values and equality between nodes. 
For completeness, we repeat the definitions of those functions here. 
</p>

  <p>The data model includes two equality functions:
  <emph>xfo:value-equal</emph> and <emph>xfo:node-equal</emph>.
  The <emph>xfo:value-equal</emph> function denotes equality of values, 
  and the <emph>xfo:node-equal</emph> function denotes equality of node identities.</p>

  <p id="equality" role="definition">
xfo:value-equal : (<emph>Sequence&lt;UnitValue&gt;</emph>, <emph>Sequence&lt;UnitValue&gt;</emph>) -> xs:boolean
xfo:node-equal  : (<emph>Node</emph>, <emph>Node</emph>) -> xs:boolean
  </p>

  <p>We define the value-equality function, <emph>xfo:value-equal</emph>, as follows.
  We assume value equality over simple values is defined.
  Equality over all other data model values is defined recursively:</p>

  <ulist>
    <item>
      <p>Given attributes <emph>a1</emph> and <emph>a2</emph>,
      <code>xfo:value-equal</code>(<emph>a1</emph>,<emph>a2</emph>),
      if and only if 
      <code>xfo:value-equal</code>(<code>name</code>(<emph>a1</emph>), <code>name</code>(<emph>a2</emph>)) and 
      <code>xfo:value-equal</code>(<code>value</code>(<emph>a1</emph>), <code>value</code>(<emph>a2</emph>)).</p>
    </item>
    <item>
      <p>Given elements <emph>e1</emph> and <emph>e2</emph>,
      <code>xfo:value-equal</code>(<emph>e1</emph>, <emph>e2</emph>),
      if and only if 
      <code>xfo:value-equal</code>(<code>name</code>(<emph>e1</emph>), <code>name</code>(<emph>e2</emph>)) and 
      <code>xfo:value-equal</code>(<code>attributes</code>(<emph>e1</emph>), <code>attributes</code>(<emph>e2</emph>)) and 
      <code>xfo:value-equal</code>(<code>children</code>(<emph>e1</emph>), <code>children</code>(<emph>e2</emph>)).</p>
    </item>
    <item>
      <p>Given two sequences (<emph>u</emph><sub>1</sub>, ..,
      <emph>u</emph><sub>j</sub>) and
      (<emph>v</emph><sub>1</sub>, ..., <emph>v</emph><sub>k</sub>),
      <code>xfo:value-equal</code>((<emph>u</emph><sub>1</sub>,
      .., <emph>u</emph><sub>j</sub>),
      (<emph>v</emph><sub>1</sub>, ...,
      <emph>v</emph><sub>k</sub>)) holds if and
      only if <emph>j</emph> = <emph>k</emph> and <code>xfo:value-equal</code>(<emph>u</emph><sub>i</sub>,
      <emph>v</emph><sub>i</sub>) holds for all 1 &lt;= <emph>i</emph> &lt;=
      <emph>n</emph>.</p>
    </item>
  </ulist>

  <p>The function <code>xfo:node-equal</code> is only defined on
  nodes.  For two nodes <emph>n1</emph> and <emph>n2</emph>,
  <code>xfo:node-equal</code>(<emph>n1</emph>, <emph>n2</emph>) holds if and only if
  <emph>n1</emph> and <emph>n2</emph> were
  created by the same application of a node constructor (See <specref
  ref="nodes"/>).</p>

  <ednote><edtext>MF: Should value equality over elements include all
  comment and PI children? See <specref ref="Issue-0015"/>.</edtext></ednote>

</div1>

<!-- Distributed throughout document

<div1 id="constraints">
  <head>Constraints</head>
  
  <ednote><edtext>JM: Distribute this information throughout the document, 
  similar to Validation Constraints in XML 1.0 or XML Schema specs?</edtext></ednote>

  <p>A data-model instance must satisfy the following constraints:</p>

  <ulist>
    <item>
      <p>Node identity: <code>node-equal</code>(<emph>n1, n2</emph>) holds 
      if and only if <emph>n1</emph> and <emph>n2</emph> were created by the 
      the same application of a node constructor (See <specref ref="nodes"/>).</p>
    </item>
    <item>
      <p>Unique parent: a node has at most one parent.</p>
    </item>
    <item>
      <p>Parent-child relationships: Given an <code>ElementNode</code> node 
      <code>p</code> and an  <code>ElementNode</code>, <code>TextNode</code>,
      <code>ReferenceNode</code>, <code>CommentNode</code>, or 
      <code>ProcessingInstructionNode</code> <emph>n</emph>, 
      <code>node-equal</code>(<code>parent</code>(<emph>n), p</emph>) 
      holds if and only if <emph>n</emph> is in <code>children</code>(<emph>p</emph>).</p>
  
      <p>Similarly, given a <emph>DocumentNode</emph> node <emph>d</emph>
      and a node <emph>n</emph>, 
      <code>node-equal</code>(<emph>parent(n), d</emph>) 
      if and only if <emph>n</emph> is in <code>children</code>(<emph>d</emph>).</p>

      <p>Given a <emph>AttributeNode</emph> (or <emph>NamespaceNode</emph>) 
      <emph>a</emph> and a node <emph>n</emph>, <code>node-equal</code>(<emph>parent(a), n</emph>)
      if and only if <emph>a</emph> is in <emph>attributes(n)</emph>
      (<emph>namespaces(n)</emph>).</p>
    </item>
    <item>
      <p>Global order: If two nodes <emph>n1</emph> and <emph>n2</emph>
      are in different documents, the result of <code>before</code> is 
      implementation-defined, but stable. In addition, if <emph>n1</emph> 
      and <emph>n2</emph> are in one tree, and <emph>m</emph> is in a 
      different tree, then <code>not</code> 
      (<code>before</code>(<emph>n1</emph>, <emph>m</emph>)
      <code>and</code> <code>before</code>(<emph>m</emph>, <emph>n2</emph>)) 
      holds.</p>
    </item>
    <!- - 
    - If a node is not a DocNode or ElementNode, then children(n) is an empty
    collection.
    - ->
    <item>
      <p>Unique attributes: All the attributes of an element have distinct
      names.</p>
    </item>
    <item>
      <p>Unique namespace prefixes: All the namespaces of an element have 
      distinct prefixes.</p>
    </item>
    <!- -
    <item>
      <p>If an element E has a namespace node with non-null prefix P, then an
      element E2 that is a child of E also has a namespace node with prefix P.
      </p>
    </item>
    - ->
  </ulist>
</div1>
-->
<div1><head>Example</head>
<p>We use the following XML document to illustrate the information contained in 
an instance of the data model:</p>
<eg>
&lt;?xml version=1.0?&gt;
&lt;p:part xmlns:p="http://www.mywebsite.com/PartSchema"
      xs:schemaLocation = "http://www.mywebsite.com/PartSchema
                            http://www.mywebsite.com/PartSchema"
      name="nutbolt"&gt;
  &lt;mfg&gt;Acme&lt;/mfg&gt;
  &lt;price&gt;10.50&lt;/price&gt;
&lt;/p:part&gt;
</eg>
<p>The document is valid with respect to the following XML schema:</p>
<eg>
&lt;xs:schema xmlns:xsd="http://www.w3.org/1999/XMLSchema"
  targetNamespace="http://www.mywebsite.com/PartSchema"&gt;
  &lt;xs:element name="part" type="part-type"&gt;
    &lt;xs:complexType name="part-type"&gt;
      &lt;xs:element name = "mfg" type="xs:string"/&gt;
      &lt;xs:element name = "price" type="xs:decimal"/&gt;
      &lt;xs:attribute name = "name" type="xs:string"/&gt;
    &lt;/xs:complexType&gt;
  &lt;/xs:element>
&lt;/xs:schema>
</eg>
<p>For this example, we chose an XML document and an XML Schema 
that illustrates the relationship between 
document content and its associated schema type information. 
In general, an XML Schema is not required,
that is, the data model can represent a schemaless, well-formed XML
document with the rules described in <specref ref="types"/>.
</p>
<p>
The XML document is represented by the data-model constructors below.
The value <emph>D1</emph> represents a document node; 
the values <emph>E1, E2, etc.</emph> represent element nodes; 
the values <emph>A1, ...</emph> represent attribute nodes;
the values <emph>N1, ...</emph> represent namespace nodes;
the values <emph>T1, ...</emph> represent text nodes;
the values <emph>SC1, ...</emph> represent schema component values;
</p>
<p role="definition">
// Document node D1
children(D1)     = E1
parent(D1)       = empty-sequence()
                                       
// Element node E1
name(E1)         = xfo:expanded-QName("http://www.mywebsite.com/PartSchema", "part")
children(E1)     = append(E2, E3)
attributes(E1)   = A1
namespaces(E1)   = N1
parent(E1)       = D1
declaration(E1)  = SC1

typed-valued(E1) = empty-sequence()
type(E1)         = SC2

// Attribte node A1
name(A1)         = xfo:QNAME(empty-sequence(), "name")
string-value(A1) = "nutbolt"
parent(A1)       = E1
declaration(A1)  = SC3

typed-value(A1)  = "nutbolt"
type(A1)         = SC4
                                  
// Namespace node N1
name(N1)       = xfo:expanded-QName(empty-sequence(), "p")
uri(N1)        = xfo:anyURI("http://www.mywebsite.com/PartSchema")
parent(N1)     = E1

// Element node E2
name(E2)        = xfo:QNAME(empty-sequence(), "mfg")
children(E2)    = T1
attributes(E2)  = empty-sequence()
namespaces(E2)  = N1
parent(E2)      = E1
declaration(E2) = SC5

typed-value(E2) = simple-value("Acme", SC4)
type(E2)        = SC4

// Element node E3
name(E3)       = xfo:QNAME(empty-sequence(), "price")
children(E3)   = T2
attributes(E3) = empty-sequence()
namespaces(E3) = empty-sequence()
parent(E3)     = E1
declaration(E3) = SC6

typed-value(E3) = simple-value(10.50, SC7)
type(E3)        = SC7

// Text node T1		       
value(T1)      = "Acme"
parent(T1)     = E2
 
// Text node T2			       
value(T2)      = "10.50"
parent(T2)     = E3

// Schema component SC1
component-kind(SC1)        = "element-declaration"
name(SC1)                  = 
  xfo:expanded-QName("http://www.mywebsite.com/PartSchema", "part")
parent(SC1)                = empty-sequence()
base(SC1)                  = xs:AnyElement
derived-by-extension(SC1)  = false
derived-by-refinement(SC1) = true

// Schema component SC2 
component-kind(SC2)        = "type-definition"
name(SC2)                  = 
  xfo:expanded-QName("http://www.mywebsite.com/PartSchema", "part-type")
parent(SC2)                = SC1
base(SC2)                  = xs:AnyComplexType
derived-by-extension(SC2)  = false
derived-by-refinement(SC2) = true

// Schema component SC3
component-kind(SC3)        = "attribute-declaration"
name(SC3)                  = 
  xfo:expanded-QName("http://www.mywebsite.com/PartSchema", "name")
parent(SC3)                = SC1
base(SC3)                  = xs:AnyAttribute
derived-by-extension(SC3)  = false
derived-by-refinement(SC3) = true


// Schema component SC4
component-kind(SC4)        = "simple-type-definition"
name(SC4)                  = 
  xfo:expanded-QName("http://www.w3.org/1999/XMLSchema", "string")
parent(SC4)                = empty-sequence()
base(SC4)                  = xs:AnySimpleType
derived-by-extension(SC4)  = false
derived-by-refinement(SC4) = true

// Schema component SC5
component-kind(SC5)        = "element-declaration"
name(SC5)                  = 
  xfo:expanded-QName("http://www.mywebsite.com/PartSchema", "mfg")
parent(SC5)                = SC2
base(SC5)                  = xs:AnyElement
derived-by-extension(SC5)  = false
derived-by-refinement(SC5) = true

// Schema component SC6
component-kind(SC6)        = "element-declaration"
name(SC6)                  = 
  xfo:expanded-QName("http://www.mywebsite.com/PartSchema", "price")
parent(SC6)                = SC2
base(SC6)                  = xs:AnyElement
derived-by-extension(SC6)  = false
derived-by-refinement(SC6) = true

// Schema component SC7
component-kind(SC7)        = "simple-type-definition"
name(SC7)                  = 
  xfo:expanded-QName("http://www.w3.org/1999/XMLSchema", "decimal")
parent(SC7)                = empty-sequence()
base(SC7)                  = xs:AnySimpleType
derived-by-extension(SC7)  = false
derived-by-refinement(SC7) = true

</p>
<!--
<p>
A graphical depiction of the
data-model instance, containing the information described in
the text above, is also included.
</p>
<p>
<graphic source="picture.xfig.gif" alt="Graphical depiction of data
model instance."/> 
</p>
-->
<ednote><edtext>MF: New graphic is needed here.</edtext></ednote>
</div1>

<div1>
  <head>XML Information Set Conformance</head>

  <p>This specification conforms to the XML Information Set <bibref ref="xml-infoset"/>.
  The following information items must be exposed by the infoset producer 
  to construct an instance of the data model:</p>
    
  <ulist>
    <item><p>The <emph role="info-item">Document Information Item</emph> with
             <emph role="infoset-property">base URI</emph> and
             <emph role="infoset-property">children</emph> properties.</p></item>
             
    <item><p><emph role="info-item">Element Information Items</emph> with
             <emph role="infoset-property">children</emph>,
             <emph role="infoset-property">attributes</emph>,
             <emph role="infoset-property">in-scope namespaces</emph>,
             <emph role="infoset-property">local name</emph>,
             <emph role="infoset-property">namespace URI</emph>,
             <emph role="infoset-property">parent</emph> properties.</p></item>

    <item><p><emph role="info-item">Attribute Information Items</emph> with
             <emph role="infoset-property">namespace URI</emph>,
             <emph role="infoset-property">local name</emph>,
             <emph role="infoset-property">normalized value</emph>,
             <emph role="infoset-property">owner element</emph> properties.</p></item>

    <item><p><emph role="info-item">Character Information Items</emph> with
             <emph role="infoset-property">character code</emph> and
             <emph role="infoset-property">parent</emph> properties.</p></item>

    <item><p><emph role="info-item">Processing Instruction Information Items</emph> with
             <emph role="infoset-property">target</emph>,
             <emph role="infoset-property">content</emph> and
             <emph role="infoset-property">parent</emph> properties.</p></item>

    <item><p><emph role="info-item">Comment Information Items</emph> with
             <emph role="infoset-property">content</emph> and
             <emph role="infoset-property">parent</emph> properties.</p></item>

    <item><p><emph role="info-item">Namespace Information Items</emph> with
             <emph role="infoset-property">prefix</emph> and
             <emph role="infoset-property">namespace URI</emph> properties.</p></item>
  </ulist>
  
  <p>Other information items and properties made available by the
  Infoset processor are ignored.  In addition to the properties above, 
  the following properties from the PSV Infoset are required:</p>
  
  <ulist>
    <item><p><emph role="infoset-property">validity</emph>, 
             <emph role="infoset-property">element declaration</emph>,
             <emph role="infoset-property">type definition</emph>, and
             <emph role="infoset-property">schema normalized value</emph> properties on
             <emph role="info-item">Element Information Items</emph>.</p></item>

    <item><p><emph role="infoset-property">attribute declaration</emph>, 
             <emph role="infoset-property">type definition</emph>, and  
             <emph role="infoset-property">schema normalized value</emph> properties on
             <emph role="info-item">Attribute Information Items</emph>.</p></item>
  </ulist>

</div1>

<div1>
<head>References</head>
<blist>
<!--
  <bibl id="CLR" key="CLR">
  T. Cormen, C. Leiserson, R. Rivest,
  <emph>Introduction to Algorithms</emph>,
  MIT Press, 1991.
  </bibl>

  <bibl id="Knuth" key="Knuth">D. Knuth, <emph>The Art of Computer Programming,
  Vol. 1</emph>, Addison-Wesley, 1973.
  </bibl>

  <bibl id="Wadler" key="Wadler"> P. Wadler, <emph>A formal
  semantics of patterns in XSLT</emph>. Available at: 
  <loc href="http://www.cs.bell-labs.com/who/wadler/papers/xsl-semantics/xsl-semantics.pdf">http://www.cs.bell-labs.com/who/wadler/papers/xsl-semantics/xsl-semantics.pdf</loc>
  </bibl>

  <bibl id="CanonicalXML" key="Canonical XML">
  World Wide Web Consortium, 
  Canonical XML. 
  <loc href="http://www.w3.org/TR/xml-c14n">http://www.w3.org/TR/xml-c14n</loc>.
  </bibl>

  <bibl id="xml-fragment" key="XML Fragment Interchange">
    World Wide Web Consortium, 
    <emph>XML Fragment Interchange</emph>. 
    Available at: <loc
    href="http://www.w3.org/TR/xml-fragment">http://www.w3.org/TR/xml-fragment</loc>
  </bibl>

-->

<bibl id="DOM" key="Document Object Model">
  World Wide Web Consortium, 
  <emph>Document Object Model</emph>. 
  See <loc href="http://www.w3.org/TR/DOM-Level-2-Core/">http://www.w3.org/TR/DOM-Level-2-Core/</loc>.
</bibl>

<bibl id="xml-rec" key="XML Recommendation">
  World Wide Web Consortium, 
  <emph>Extensible Markup Language (XML) 1.0 (Second Edition)</emph>
  See <loc href="http://www.w3.org/TR/REC-xml">http://www.w3.org/TR/REC-xml</loc>.
</bibl>

<bibl id="xml-activity" key="XML Activity">
  World Wide Web Consortium, 
  <emph>XML Activity</emph>. 
  Home page: <loc href="http://www.w3.org/XML/">http://www.w3.org/XML/</loc>.
</bibl>

<bibl id="xml-infoset" key="XML Information Set">
  World Wide Web Consortium, 
  <emph>XML Information Set (Infoset)</emph>.
  See <loc href="http://www.w3.org/TR/xml-infoset/">http://www.w3.org/TR/xml-infoset/</loc>.
</bibl>

<bibl key="XPath" id="XPath">
  World-Wide Web Consortium
  <emph>XML Path Language (XPath)</emph>: Version 1.0. 
  November, 1999. 
  See <loc href="http://www.w3.org/TR/xpath.html">http://www.w3.org/TR/xpath.html</loc>.
</bibl>

<bibl id="XPathReq" key="XPath Requirements Version 2.0">
  World Wide Web Consortium, 
  <emph>XPath Requirements Version 2.0</emph>.
  See <loc href="http://www.w3.org/TR/xpath20req">http://www.w3.org/TR/xpath20req</loc>.
</bibl>

<bibl id="xpointer" key="XML Pointer Language (XPointer)">
  World Wide Web Consortium, 
  <emph>XML Pointer Language (XPointer)</emph>.
  See <loc href="http://www.w3.org/TR/xptr">http://www.w3.org/TR/xptr</loc>.
</bibl>

<bibl id="XSLT" key="XSL Transformations">
  World Wide Web Consortium, 
  <emph>XSL Transformations Language (XSLT)</emph>: Version 1.0. 
  See <loc href="http://www.w3.org/TR/xslt">http://www.w3.org/TR/xslt</loc>.
</bibl>

<bibl id="XSFD" key="XML Schema: Formal Description">
  World-Wide Web Consortium
  <emph>XML Schema: Formal Description</emph>, Working Draft, 
  March 2001. 
  See <loc href="http://www.w3.org/TR/xmlschema-formal/">http://www.w3.org/TR/xmlschema-formal/</loc>.
</bibl>

<bibl id="xmlschema-1" key="XMLSchema Part 1">
  World Wide Web Consortium, 
  <emph>XML Schema Part 1: Structures</emph>.
  See <loc href="http://www.w3.org/TR/xmlschema-1/">http://www.w3.org/TR/xmlschema-1</loc>.
</bibl>

<bibl id="xmlschema-2" key="XMLSchema Part 2">
  World Wide Web Consortium, 
  <emph>XML Schema Part 2: Datatypes</emph>.
  See <loc href="http://www.w3.org/TR/xmlschema-2/">http://www.w3.org/TR/xmlschema-2</loc>.
</bibl>

<bibl id="XQFS" key="XQuery 1.0 Formal Semantics">
  World Wide Web Consortium, 
  <emph>XQuery 1.0 Formal Semantics</emph>.
  See <loc href="http://www.w3.org/TR/query-semantics/">http://www.w3.org/TR/query-semantics/</loc>
</bibl>

<bibl id="XQWG" key="XML Query Working Group">
  World Wide Web Consortium, 
  <emph>XML Query Working Group</emph>.
  Home page: <loc href="http://www.w3.org/XML/Activity#query-wg">http://www.w3.org/XML/Activity#query-wg</loc>.
</bibl>

<bibl id="XSLWG" key="XSL Working Group">
  World Wide Web Consortium, 
  <emph>XSL Working Group</emph>.
  Home page: <loc href="http://www.w3.org/Style/XSL/">http://www.w3.org/Style/XSL/</loc>.
</bibl>

<bibl id="XQuery" key="XQuery 1.0: A Query Language for XML">
  World Wide Web Consortium, 
  <emph>XQuery 1.0: A Query Language for XML</emph>.
  See <loc href="http://www.w3.org/TR/xquery/">http://www.w3.org/TR/xquery/</loc>.
</bibl>

<bibl key="XML Query Data Model" id="XQDM00">
  World-Wide Web Consortium
  <emph>XML Query Data Model</emph>, Working Draft, Feb 2001.
  See <loc href="http://www.w3.org/TR/2001/WD-query-datamodel-20010215/">http://www.w3.org/TR/2001/WD-query-datamodel-20010215/</loc>.
</bibl>

<bibl id="XQueryReq" key="XML Query Requirements">
  World Wide Web Consortium, 
  <emph>XML Query Requirements</emph>.
  See <loc href="http://www.w3.org/TR/2000/WD-xmlquery-req-20000131">http://www.w3.org/TR/2000/WD-xmlquery-req-20000131</loc>.
</bibl>

</blist>
</div1>
</body>

<back>

<div1 id="appendix-issues-list"><head>Issues</head>
<p>
The issues in
 <specref ref="appendix-issues-list"/> serve as a design history for
this
document. The ordering of issues is irrelevant. Each issue has a unique id of
the form Issue-&lt;dddd&gt; (where d is a digit). This can be used for
referring to the issue by &lt;url-of-this-document&gt;#Issue-&lt;dddd&gt;.
Furthermore, each issue has a mnemonic header, a date, an optional description,
and an optional resolution. For convenience, resolved issues are displayed in green.
Some of the issues contain references to W3C internal archives. These are marked
with "W3C-members only". Some of the descriptions of the resolved issues are
obsolete w.r.t. to the current version of the document.
</p>
<div2><head>Issues</head>
<issue id="Issue-0001" date="Oct-2000" raisedby="Datamodel Editors">
<head>PSV Infoset identity constraints</head>
<description>
<p>
What should be data-model representation, if any, of PSV Infoset
identity-constraint tables?  
</p>
</description>
</issue>
<issue id="Issue-0002"  date="Oct-2000" raisedby="Datamodel Editors" status="closed">
<head>Representation of atomic values
</head>
<description>
<p>
This function assumes that the character information items for an
atomic value (e.g., string, integer, floating-point number) are
not interleaved with other information items (e.g., PIs or comments).
The treatment of such interleaved values is not handled in this
definition. 
This issue is addressed in threads beginning at: 
<loc
href="http://lists.w3.org/Archives/Member/w3c-archive/2000Jun/0090.html">
http://lists.w3.org/Archives/Member/w3c-archive/2000Jun/0090.html (W3C-members only)</loc>
and 
<loc
href="http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2000Sep/0079.html">http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2000Sep/0079.html (W3C-members only)</loc>.</p>
</description>
<resolution date="15-Jan-2001"><p>MF: The data model does not
preserve information items interleaved with the character info items
of an atomic value.</p>
</resolution>
</issue>

<issue id="Issue-0003"  date="Oct-2000" raisedby="Datamodel Editors">
<head>Example parent
</head>
<description>
<p><emph>Remark Michael:</emph> An IDREF cannot
point to an empty string.</p>
</description>
</issue>

<issue id="Issue-0004"  date="Oct-2000" raisedby="Datamodel Editors">
<head>Schema/DTD</head>
<description>
<p>A document may refer to a DTD and have an associated schema.</p>
</description>
</issue>

<issue id="Issue-0005"  date="Oct-2000" raisedby="Datamodel Editors">
<head>Lists of Simple Values</head>
<description>
<p>The current data model draft takes only into account
singleton value-nodes.  It must represent lists of simple-type values
as well.

See <loc
href="http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2000May/0060.html">http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2000May/0060.html.(W3C-members only)
</loc>
</p>
<p>
Peter suggests having a special-purpose kind of a TextNode that
represents lists of simple types.
An advantage of this approach is that the constraint that lists of
simple types be homogeneous/monomorphic can be enforced. 
However, lists/forests already can be modeled in current data model, without
adding more complexity. 
For example, an attribute's value could be modeled as a list of TextNodes:
</p>
<p role="definition">
value    : <loc href="#AttributeNode">AttributeNode</loc>  -> Sequence&lt;<loc href="#primvalue">TextNode</loc>&gt;
</p>
<p>
A disadvantage of this approach is that the 
monomorphism constraint on lists derived from simple types is not
enforced.
However, given a type system for Query, such a constraint could
be enforced.  So Mary is in favor of not having a special-purpose
kind of TextNode to represent lists, but instead model them by 
forests directly in the data model.
</p>
</description>
</issue>

<issue id="Issue-0006"  date="Oct-2000" raisedby="Datamodel Editors" status="closed">
<head>Collections</head>
<description><p>We need a more 
thorough definition of collections, perhaps in a separate section,
which includes bags and defines collections formally. 
</p>
<p>
In particular, the algebra (probably) will not support arbitrarily
nested collections (i.e., lists of lists, sets of sets, etc.).  We
need to specify how collections are constructed.  For example, 
in the data model, the basic collection is a forest, i.e., a list of
Nodes.  The forest constructor creates a singleton forest from one
Node; or it creates a forest from two forests by concatenating
the two forests: 
</p>
<eg>
Forest = Node | Sequence&lt;Node&gt;

forest : Node -> Forest
function forest(Node n) =  Sequence&lt;n&gt;

union : (Forest, Forest) -> Forest
function union(f1, f2) = list-append f1 f2

bagunion : (NodeBag, NodeBag) -> NodeBag
setunion : (NodeSet, NodeSet) -> NodeSet
</eg>
<p>Similar constructors would exist for bags with and
without duplicates.</p>
<p role="definition">
unordered : Forest -> NodeBag
unique    : NodeBag -> NodeSet
set = unique o unordered : Forest -> NodeSet
</p>
</description>
<resolution date="15-Jan-2001"><p>Added section on Collections
<specref ref="sequences"/>.</p>
</resolution>
</issue>

<issue id="Issue-0007"  date="Oct-2000" raisedby="Datamodel Editors">
<head>
TextNodes</head>
<description>
<p>An alternative representation is to
have a single TextNode whose base type is string: 
</p>
<p role="definition">
text-node  : (xs:string, S, Sequence&lt;Node]) -> <loc href="#primvalue">TextNode</loc></p>
<p>
This representation is more closely aligned with other node types
in the data model, but it makes the simple type of leaf-node values opaque.
</p>
<p> Peter Fankhauser compares and constrasts these options in : 
<loc
href="http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2000Apr/0174.html">http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2000Apr/0174.html
(W3C-members only)</loc>
</p>
</description>
</issue>

<issue id="Issue-0008"  date="Oct-2000" raisedby="Michael Rys" status="closed">
<head>Node vs edge centric data model</head>
<description>
<p><emph>Cite:</emph></p>
<p>
Let me summarize my issues
with a node-centric datamodel right at the beginning. The first two are
mentioned in the doc
later on:</p>
<p>
As long as (1) the data represents a tree, (2) easy bi-directional is not
required, (3) projection/extension operations with object-preserving
semantics are not required, a node-centric datamodel is isomorphic to an
edge-centric datamodel and is easier to represent and understand.
</p><p>
As soon as anyone of the above requirements change, an edge model has
several advantages:
</p>
<olist>
<item><p>data represents a graph: naming the edges (relationships) becomes a
must, since the names are now on the relationships and not on the objects.
Uniform treatment of all edges (even the so far anonymous containment edges)
makes defining operations easier since they are more orthogonal. With the
possibility of distinguishing "type" from "name", even subelement names now
semantically represent relationship names. For example, ShipAddr and
BillAddr in
</p>
<p>
&lt;Order&gt;
  &lt;ShipAddr dt:dt="Address"&gt;...&lt;/ShipAddr&gt;
  &lt;BillAddr dt:dt="Address"&gt;...&lt;/BillAddr&gt;
&lt;/Order&gt;
</p><p>
are denoting relationships (ownership to be exact) from the order element to
the Address elements.
</p>
</item>
<item><p>As soon as backwards pointers are introduced into a node-centric
model,
the representation becomes more complex and less elegant. Transforming data
becomes more complex since the backwards pointer becomes part of the object
state. Thus, if I define views where an element changes the parent, in the
edge-centric case, this just adds a new relationship, the object state is
unchanged, in the node-centric approach, I need to express now two parents
in the object state.</p>
</item>
<item><p>Projection/extension operations. Assume that I pose a query that
projects name and address but hides the age of a person element. In the
edge-centric approach, this means that the query logically transforms the
graph context on which the query operates by removing the age edge from the
context without touching the object state (the objects keeps its basetype),
in the node-centric approach, the object state needs to change since the
context transformation will remove the attribute property age. While both
operations transform the context, I find the former to be more elegant than
the later.</p>
</item>
</olist>
</description>
<resolution date="15-Jan-2001"><p>MF: To align with XPath 1.0 and the Algebra,
the data model is node centric.</p></resolution>
</issue>

<issue id="Issue-0009"  date="Oct-2000" raisedby="Michael Rys">
<head>Schema info</head>
<description>
<p><emph>Cite:</emph>
Sometimes one wants to use different schemata over the same basic XML
fragment. So I would rather start with that in principle, the data model is
schemaless and can provide the data model of any XML fragment given a schema.
Thus, the schema postprocessing becomes a datamodel transformation that we
make explicit (and that could be optimized with other operations that
transform the datamodel graph).
</p>
</description>
</issue>

<issue id="Issue-0010"  date="Oct-2000" raisedby="Datamodel Editors" status="closed">
<head>Node identity</head>
<description>
<p>
Should the data model require that an implementation guarantee that
the identity of a node is always preserved?
</p>
</description>
<resolution date="15-Jan-2001"><p>MF: The data model always preserves
node identity; the only operator that does not preserve node identity
is <code>copy</code>.   
</p></resolution>
</issue>
  <issue id="Issue-0011" date="Oct-2000" raisedby="Datamodel Editors">
<head>Access to facets</head>
<description>
  <p>In XML Schema, facets such as ``nullable'' is associated with an <emph>element
  declaration</emph>, which is a element name, complex type
  pair.   If the query language needs access to such facets,
  we may need to replace <emph>ReferenceNode</emph> by a reference
  to the element declaration. 
  </p>
</description>
  </issue>

<issue id="Issue-0012"  date="Oct-2000" raisedby="Michael Rys">
<head>Representation of reference values</head>
<description><p><emph>Cite:</emph>

The current representation of reference values is too much IDREF(S) centric. I
would prefer a more general representation for XLink and the schema (and
potentially graph operation)
introduced reference mechanisms.
</p>
</description>
</issue>

<issue id="Issue-0013" date="17-Jan-2001" raisedby="Mary Fernandez" status="closed">
<head>Equality operators on collections</head>
<description><p>Equality operators '=' on collections are not defined.
</p>
</description>
<resolution date="27-March-2001">
<p>MF: Added in <specref ref="functions"/>.
</p>
</resolution>
</issue>

<issue id="Issue-0014" date="17-Jan-2001" raisedby="Mary Fernandez" status="closed">
<head>Elements with unordered children</head>
<description><p>Should the element constructor <loc
href="#element-node">element-node</loc> also permit bags of children?
</p>
</description>
<resolution  date="13-April-2001"><p>MF: decision to use sequences everywhere in
data model.</p>
</resolution>
</issue>
<issue id="Issue-0015" date="02-Feb-2001" raisedby="Mary Fernandez">
<head>Semantics of value equality operator '='</head>
<description><p>The semantics of the value equality operator '=' is
undefined </p></description>
</issue>

<issue id="Issue-0016" date="21-Feb-2001" raisedby="Michael Rys" status="closed">
<head>PSV Infoset Mapping - undefined terms</head>
<description><p><code>Code</code> is undefined. </p></description>
<resolution date="25-Apr-2001"><p>Defined in <specref ref="TextNode"/>.</p></resolution>
</issue>

<issue id="Issue-0017" date="03-Mar-2001" raisedby="Mary Fernandez" status="closed">
<head>Relationship between Ordered and Unordered collections</head>
<description><p>The relationship between ordered and unordered
collections is not specified.  Any ordered collection can be treated
as an unordered collection.</p></description>
<resolution date="25-Apr-2001"><p>Unordered collections removed.</p></resolution>
</issue>

<issue id="Issue-0018" date="12-Mar-2001" raisedby="Michael Rys">
<head>Representation of lists of IDREFS and NMTOKENS</head>
<description><p>How are IDREF lists and NMTOKEN lists represented in
data model.</p></description>
</issue>

<issue id="Issue-0019" date="15-Mar-2001" raisedby="James Clark">
<head>Element constructor that performs schema processing</head>
<description>
  <p>An alternate is to separate element construction from schema 
  validity assessment.  The element constructor would construct an 
  element corresponding to the an element information item in the Infoset 
  before schema validity assessment. 
  To produce elements with types, the <code>schema-process</code> function 
  would schema process an element with respect to a schema type to yield a 
  new element with the full PSV infoset. The <code>schema-process</code> 
  function would ignore any type information on attributes and elements and 
  would assess the untyped value with respect to the given type.</p>
  
  <p role="definition">
element-node  : (<loc href="#value">expanded-QName</loc>, 
                 Sequence&lt;<loc href="#NamespaceNode">NamespaceNode</loc>&gt;,
                 Sequence&lt;<loc href="#AttributeNode">AttributeNode</loc>&gt;, 
                 Sequence&lt;<loc href="#ElementNode">ElementNode</loc> | <loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc> 
                         | <loc href="#TextNode">TextNode</loc> | <loc href="#CommentNode">CommentNode</loc> | <loc href="#ReferenceNode">ReferenceNode</loc>&gt;)
              -> <loc href="#ElementNode">ElementNode</loc>
schema-process : (<loc href="#ElementNode">ElementNo