<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="xmlspec-ie-dm.xsl"?>
<!DOCTYPE spec SYSTEM "xmlspec.dtd" [
  <!ENTITY date.year "2002">
  <!ENTITY date.month "April">
  <!ENTITY date.MM "04">
  <!ENTITY date.day "30">
  <!ENTITY date.DD "30">
  <!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.publoc "&url.group;&date.year;/&date.MM;/&doc.prefix;-&doc.date;.html">
  <!ENTITY url.internal "http://www.w3.org/Style/XSL/Group/xpath2-tf/&doc.prefix;-&doc.date;.html">
  <!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>
  </latestloc>
  <prevlocs role="private">
    <loc href="http://www.w3.org/TR/2001/WD-query-datamodel-20011220/">http://www.w3.org/TR/2001/WD-query-datamodel-20011220/</loc>
    <loc href="http://www.w3.org/TR/2001/WD-query-datamodel-20010607/">http://www.w3.org/TR/2001/WD-query-datamodel-20010607/</loc>
    <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 (XML Query WG)</name>
      <affiliation>AT&amp;T Labs</affiliation>
      <email href="mailto:mff@research.att.com">mff@research.att.com</email>
    </author>
    <author>
      <name>Jonathan Marsh (XSL WG)</name>
      <affiliation>Microsoft</affiliation>
      <email href="mailto:jmarsh@microsoft.com">jmarsh@microsoft.com</email>
    </author>
    <author>
      <name>Marton Nagy (XML Query WG)</name>
      <affiliation>Science Applications International Corporation (SAIC)</affiliation>
      <email href="mailto:marton.nagy@saic.com">marton.nagy@saic.com</email>
    </author>
  </authlist>
  <copyright>
    <p role="copyright">
    <loc href="http://www.w3.org/Consortium/Legal/ipr-notice-20000612#Copyright">Copyright</loc>
    &nbsp; &copy; 2002  
    <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>The most significant changes since the previous version are the
	 following.  The document has been updated to reflect decisions
	 regarding the named typing: Schema Components have been removed
	 and were replaced with Types. 
	 Accordingly the constructors and accessors referencing types
	 (element node, attribute node and atomic value constructors and the
	 type() accessor) changed, the example in the appendix updated and
	 related open issues closed.
	 Two functions (node-equal and node-before) have been added to sections
	 3.1 and 3.2.
	 The terminology and notations (such as the term "atomic value" and
	 the pseudo-code syntax) have been aligned with the other working drafts.
	 </p>

    <p>This document has been produced as part of the
    <bibref ref="w3c-style-activity"/> and the <bibref ref="w3c-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:public-qt-comments@w3.org">public-qt-comments@w3.org</loc>.
    (archived at <loc href="http://lists.w3.org/Archives/Public/public-qt-comments/">http://lists.w3.org/Archives/Public/public-qt-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="XSLT2"/>, 
    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"/>.
    This document is the result of joint work by the 
    <bibref ref="XSLWG"/> and the <bibref ref="XQWG"/>.</p>
  </abstract>
  
  <langusage>
    <language id="en">English</language>
  </langusage>

  <revisiondesc role="public">
    <p>MN: 20-April-2002.
      <ulist>
        <item>
          <p>Updated and slightly changed the example in the appendix. Also added some graphics.</p>
        </item>
        <item>
          <p>Updates based on WG comments:
          Reworded the explanations about values in section 1.
          Fixed some bugs in the definition of infoitem-to-type() in section
          3.5.
          Added a sentence on the representation of character data for
          attributes and updated the paragraph on implementation options
          in section 3.6.
          Added clarification on the identity of nodes contained in sequences
          in Section 6.
          Added dm: prefix for data model constructors and accessors.
          </p>
        </item>
        <item>
          <p>Editorial updates based on WG comments:
          Updated the bulleted list in the beginning of section 4.
          Updated the PSVI contribution in the XML Information Set
          Conformance Section.
          Added a note to the example in the appendix about our ongoing
          work on whitespace handling.
          </p>
        </item>
      </ulist>
    </p>
    <p>MN: 28-March-2002.
      <ulist>
        <item>
          <p>Added the issues <specref ref="Issue-0072"/>,
           <specref ref="Issue-0073"/> and <specref ref="Issue-0074"/>.
          </p>
        </item>
        <item>
          <p>Closed the issues
            <specref ref="Issue-0024"/>, 
            <specref ref="Issue-0054"/>.
          </p>
        </item>
        <item>
          <p>Updated the document according to the named typing proposal:
          Replaced section 3.4 Schema Components and Values with a section
          on Types.
          Rewrote section 8.1 Mapping PSV Infoset additions to Schema Components
          Moved that subsection to 3.5 and removed the rest of section 8.
          Updated the sections on element nodes, attribute nodes, and simple
          typed values (removed the declaration() accessor, changed type()
          to return xs:QName, replaced SchemaComponent with xs:QName).
          </p>
        </item>
        <item>
          <p>Added the functions <emph>node-equal</emph> and
          <emph>node-before</emph> to sections 3.1 and 3.2.</p>
        </item>
        <item>
          <p>Aligned the terminology with the other working drafts (value,
          atomic value, sequence, item, etc.) Updated the names of the
          element node, attribute node and atomic value constructors.
          Updated the section 5 on atomic values, removed the mention
          of primitive values and the constructor that takes primitive
          values.</p>
        </item>
        <item>
          <p>Aligned the notations with the other working drafts:
          Replaced the Sequence&lt;V&gt; notation with the occurrence
          indicators *,?,+. Updated the pseudo-code to use XQuery syntax
          and closed the corresponding issue <specref ref="Issue-0067"/>.
          </p>
        </item>
        <item>
          <p>Closed the following type-related issues:
            <specref ref="Issue-0009"/>,
            <specref ref="Issue-0011"/>,
            <specref ref="Issue-0022"/>,
            <specref ref="Issue-0026"/>,
            <specref ref="Issue-0031"/>,
            <specref ref="Issue-0049"/>,
            <specref ref="Issue-0056"/>,
            <specref ref="Issue-0064"/>,
            <specref ref="Issue-0066"/>.
          </p>
        </item>
        <item>
          <p>Updated the sections on element, attribute and text nodes
          to reflect the decisions regarding the behavior of the 
          typed-value (data()) function.
          See <loc href="http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2002Mar/0382.html">http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2002Mar/0382.html</loc> (member only).
          </p>
          <p>Updated the document to reflect the decisions regarding
          the resolution of Issue 17 in the Type Strawman. See
          <loc href="http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2002Mar/0178.html">http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2002Mar/0178.html</loc> (member only).
          In particular replaced xs:unknownSimpleType with xs:anySimpleType.
          </p>
        </item>

      </ulist>
    </p>
    <p>JM: 11-December-2001.
      <ulist>
        <item>
          <p>Fixed links, minor editorial issues, updated example section,
          reorganized appendices.</p>
        </item>
      </ulist>
    </p>
    <p>MN: 5-December-2001.
      <ulist>
        <item>
<p>Renamed some functions/operators to align with the F&amp;O
document: xf:concat, op:value-equals, op-item-at, op:concatenate.</p>
        </item>
        <item>
<p>Editorial: Slightly modified the definition of value categories in
Section 1 and added examples of values that can be represented by the
data model. Added a note on using elment constructors with heterogeneous
sequences in Section 4.2. Added a note to Sections 4.2 and 4.3 to
signal that we are actively working on the resolution of Issue-0036.
</p>
        </item>
        <item>
<p>Updated the section on simple typed values (formerly called simple
values). Clarified the terminology used. Got rid of the subsections
explaining Primitive Values and Derived Simple Values and merged
some of that content into the main section. Defined a second
constructor parallel to the two constructors of elements and
attributes and specified that the canonical lexical representation
is to be used when applying the string-value accessor.</p>
        </item>
        <item>
<p>Defined the canonical lexical representation for a sequence of
simple typed values. </p>
        </item>
        <item>
          <p>Closed the issues <specref ref="Issue-0027"/>,
          <specref ref="Issue-0046"/>, <specref ref="Issue-0065"/>,
          <specref ref="Issue-0055"/>.
          </p>
        </item>
        <item>
          <p>Added the issues <specref ref="Issue-0067"/>,
          <specref ref="Issue-0068"/>, <specref ref="Issue-0069"/>,
          <specref ref="Issue-0070"/>, <specref ref="Issue-0071"/>.
          </p>
        </item>
      </ulist>
    </p>
    <p>JM: 29-November-2001.
      <ulist>
        <item>
          <p>Added issue:
            <specref ref="Issue-0066"/>
          </p>
        </item>
      </ulist>
    </p>
    <p>JM: 19-November-2001.
      <ulist>
        <item>
          <p>Added issue:
            <specref ref="Issue-0065"/>
          </p>
        </item>
      </ulist>
    </p>
    <p>MN: 11-November-2001.
      <ulist>
        <item>
          <p>Continued updates relating to the treatment of common accessors.
          (In particular removed the prefix and namespace-uri accessors of a
          NamespaceNode.) Fixed sequence-accessor related inconsistencies
          between the data model and the Functions and Operators document:
          Updated the sequence sections and code samples to use the accessors
          defined in the F&amp;O document. Added references to sequence and
          QName accessor functions defined in the F&amp;O document.
          Modified the urls in the examples to use www.example.com.</p>
        </item>
        <item>
          <p>Closed issues:
            <specref ref="Issue-0053"/>
          </p>
        </item>
      </ulist>
    </p>
    <p>JM: 4-November-2001.
      <ulist>
        <item>
          <p>Closed issues:
            <specref ref="Issue-0005"/>, 
            <specref ref="Issue-0007"/>, 
            <specref ref="Issue-0043"/>
          </p>
        </item>
      </ulist>
    </p>
    <p>JM: 16-October-2001.
      <ulist>
        <item>
          <p>Added issues:
            <specref ref="Issue-0051"/>, 
            <specref ref="Issue-0052"/>, 
            <specref ref="Issue-0053"/>,
            <specref ref="Issue-0054"/>,
            <specref ref="Issue-0055"/>,
            <specref ref="Issue-0056"/>,
            <specref ref="Issue-0057"/>,
            <specref ref="Issue-0058"/>,
            <specref ref="Issue-0059"/>,
            <specref ref="Issue-0060"/>,
            <specref ref="Issue-0061"/>,
            <specref ref="Issue-0062"/>,
            <specref ref="Issue-0063"/>,
            <specref ref="Issue-0064"/>
          </p>
        </item>
      </ulist>
    </p>
    <p>JM: 17-August-2001.
      <ulist>
        <item>
          <p>Implemented editorial changes requested in
          <loc href="http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2001Aug/0066.html">http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2001Aug/0066.html</loc>
          and <loc href="http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2001Aug/0099.html">http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2001Aug/0099.html</loc>.</p>
        </item>
        <item>
          <p>Resolved issues:
            <specref ref="Issue-0001"/>, 
            <specref ref="Issue-0003"/>, 
            <specref ref="Issue-0015"/>, 
            <specref ref="Issue-0018"/>, 
            <specref ref="Issue-0020"/>, 
            <specref ref="Issue-0021"/>
          </p>
        </item>
        <item>
          <p>Added issues:
            <specref ref="Issue-0033"/>, 
            <specref ref="Issue-0034"/>, 
            <specref ref="Issue-0035"/>, 
            <specref ref="Issue-0036"/>, 
            <specref ref="Issue-0037"/>, 
            <specref ref="Issue-0038"/>, 
            <specref ref="Issue-0039"/>, 
            <specref ref="Issue-0040"/>, 
            <specref ref="Issue-0041"/>, 
            <specref ref="Issue-0042"/>, 
            <specref ref="Issue-0043"/>, 
            <specref ref="Issue-0044"/>, 
            <specref ref="Issue-0045"/>, 
            <specref ref="Issue-0046"/>, 
            <specref ref="Issue-0047"/>, 
            <specref ref="Issue-0048"/>, 
            <specref ref="Issue-0049"/>, 
            <specref ref="Issue-0050"/>
          </p>
        </item>
      </ulist>
    </p>
    
    <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="XSLT2"/> and 
  <bibref ref="XQuery"/> 1.0.</p>

  <p>The XQuery 1.0 and XPath 2.0 Data Model (henceforth "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 recommendations 
      define 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 
      complex values. (<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>Every value handled by the data model is either a <emph>sequence</emph> of
  zero or more <emph>item</emph>s, or an error. An <emph>item</emph> is either a
  <emph>node</emph> or an <emph>atomic value</emph>.

  A node is defined in <specref ref="Node"/> and is one of seven node kinds.
  An atomic value encapsulates an XML Schema atomic type
  and a corresponding value of that type. They are defined in
  <specref ref="AtomicValue"/>.
  A sequence is an ordered collection of nodes, atomic values, or any 
  mixture of nodes and atomic values.  A sequence cannot be a member of 
  a sequence.  A single item appearing on its own is modeled as a sequence
  containing one item.  Sequences are defined in <specref ref="sequences"/>.
  The <emph>error</emph> value is defined in <specref ref="error"/>.</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>The data model can represent various
  values including not only the input and the output of a query, but all
  values of expressions used during the intermediate calculations.
  Examples include the input document or document repository (represented
  as a document node or a sequence of document nodes), the result of a
  path expression (represented as a sequence of nodes), the result of an
  arithmetic or a logical expression (represented as an atomic value),
  a sequence expression resulting a sequence of integers, dates, QNames or
  other XML Schema atomic values (represented as a sequence of
  atomic values), etc.
  Examples of values that cannot be expressed directly by the data model
  include schema components, sets containing both
  atomic values and the error value, atomic values whose type
  is not an XML Schema atomic type, etc.
  </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">function dm:typed-value(<loc href="#Node">Node</loc> $n) returns <loc href="#AtomicValue">AtomicValue</loc>*</p>

  <p>In the psuedo-code syntax, the term <emph>Node</emph> denotes
  the category of node values, <emph>AtomicValue</emph> denotes the 
  category of atomic values, and <emph>Item</emph> refers to the
  category of either node values or atomic values.
  <emph>V*</emph> denotes the category of sequence 
  values all of whose members are in category <emph>V</emph>.
  <emph>V?</emph> and <emph>V+</emph> denote subcategories of
  <emph>V*</emph>: The former denotes the category of sequences
  containing zero or one items, the latter refers to sequences
  containing one or more items.
  In a sequence, <emph>V</emph> may be a <emph>Node</emph> or 
  <emph>AtomicValue</emph>, or the union (choice) of several categories of 
  <emph>Items</emph>. For example, the following denotes a category of 
  sequence containing any combination of comment and processing instruction 
  nodes:</p>
  
  <p role="definition">(<loc href="#CommentNode">CommentNode</loc> | <loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc>)*</p>
  
  <p>There are some functions in the data model that are <emph>partial
  functions</emph>. We use the occurrence indicators <emph>?</emph> or
  <emph>*</emph> when specifying the return type of such functions.
  For example, a node may have one parent node or no parent.
  If the node argument has a parent, the 
  <emph>dm:parent</emph> accessor returns a singleton sequence.  If the node
  argument does not have a parent, it returns the empty sequence.
  The signature of <emph>dm:parent</emph> specifies that it returns
  an empty sequence or a sequence containing one element or document node:</p>

  <p role="definition">function dm:parent(<loc href="#Node">Node</loc> $n) returns (<loc href="#ElementNode">ElementNode</loc> | <loc href="#DocumentNode">DocumentNode</loc>)?</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> (see <specref ref="Issue-0033"/>).
  The constructors and accessors defined by the data model are prefixed
  with <emph>dm</emph></p>
  
<!-- JM- commented out since there aren't actually any constraint expressions!

  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 node's <emph>dm:name</emph> accessor
  is always equal to the name argument of the <emph>infoitem-to-element-node</emph> constructor.
  </p>
  <p role="definition">dm:name(infoitem-to-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 
  type of its zero or more inputs and the type 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">function f(<emph>V</emph><sub>1</sub> $v<sub>1</sub>, ..., <emph>V</emph><sub>m</sub> $v<sub>m</sub>) returns <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>This document relies on the <bibref ref="xml-infoset"/>. Information items 
  and properties are indicated by the styles <emph role="info-item">information 
  item</emph> and <emph role="infoset-property">property</emph>, respectively.</p>

  <p>This document also provides pseudo-code syntax describing the mapping
  from the Infoset to the data model.  To facilitate this we introduce accessors
  to the required infoset properties through <emph>InfoItem</emph> objects.
  These infoset accessors are for rhetorical purposes only and are not intended to be exposed outside this
  specification.  We name the accessors of the Infoset using the convention 
  infoset-&lt;<emph>item-name</emph>&gt;-&lt;<emph>property-name</emph>&gt;.  
  Similarly, accessor functions that return PSV Infoset properties use the 
  naming convention psvi-&lt;<emph>item-name</emph>&gt;-&lt;<emph>property-name</emph>&gt;.
  For example, <code>infoset-element-attributes</code> is the accessor that 
  returns an element information item's <emph role="infoset-property">attributes</emph> 
  property:</p>

  <p role="definition">function infoset-element-attributes(<loc href="#ElementItem">ElementItem</loc> $ii) returns <loc href="#AttributeItem">AttributeItem</loc>*</p>

  <p>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.</p>

  <p>The <emph>infoitem-kind</emph> accessor
  returns a string value representing the information item's kind, either 
  <code>"document"</code>, <code>"element"</code>, <code>"attribute"</code>, 
  <code>"character"</code>, <code>"namespace"</code>, 
  <code>"processing-instruction"</code>, <code>"comment"</code>, <code>"doctype"</code>,
  <code>"notation"</code>, or <code>"unparsed-entity"</code>.</p>

  <p role="definition" id="InfoItem">function infoitem-kind(InfoItem $ii) returns <loc href="#dt-atomic-value">xs:string</loc></p> 

  <p>Throughout this document, the namespace prefix <code>xs</code> indicates
  the <bibref ref="xmlschema-1"/> namespace name 
  <code>http://www.w3.org/2001/XMLSchema</code>.
  The namespace prefixes <code>xf</code> and <code>op</code> indicate
  the namespace of the functions and operators defined in
  <bibref ref="XFO"/>.They are associated with the namespace names
  <code>http://www.w3.org/2001/12/xquery-functions</code> and
  <code>http://www.w3.org/2001/12/xquery-operators</code> respectively.</p>
  
  <p>The following functions and operators are defined in
  <bibref ref="XFO"/>:</p>

  <ulist>
    <item><p id="op_concatenate">op:concatenate</p></item>
    <item><p id="op_item-at">op:item-at</p></item>
    <item><p id="op_value-equal">op:value-equal</p></item>
    <item><p id="xf_anyURI">xf:anyURI</p></item>
    <item><p id="xf_concat">xf:concat</p></item>
    <item><p id="xf_count">xf:count</p></item>
    <item><p id="xf_decimal">xf:decimal</p></item>
    <item><p id="xf_empty">xf:empty</p></item>
    <item><p id="xf_get-local-name">xf:get-local-name</p></item>
    <item><p id="xf_get-namespace-uri">xf:get-namespace-uri</p></item>
    <item><p id="xf_NCName">xf:NCName</p></item>
    <item><p id="xf_QName">xf:QName</p></item>
    <item><p id="xf_QName-from-uri">xf:QName-from-uri</p></item>
    <item><p id="xf_QName-from-string">xf:QName-from-string</p></item>
    <item><p id="xf_string">xf:string</p></item>
    <item><p id="xf_sublist">xf:sublist</p></item>
  </ulist>
</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.  The identity of a node is established 
    when a node-constructor is applied to create the node: each 
    application of a node constructor creates a new node that is 
    identical to itself, and not identical to any other node
    (see <specref ref="Node"/>).</p>
    
    <p>The <emph>dm:node-equal</emph> function takes two nodes as arguments.
    It returns true if the arguments are identical and false otherwise.
    </p>

    <p role="definition">
function dm:node-equal(<loc href="#Node">Node</loc> $n1, <loc href="#Node">Node</loc> $n2) returns <loc href="#dt-atomic-value">xs:boolean</loc>
    </p>
    
    <p>This concept should not be confused with the concept of
    <emph>unique ID</emph>, which is a unique name assigned to an
    element by the author to represent references using ID/IDREF
    correlation.</p>
  </div2>
  
  <div2>
    <head>Document Order</head>
      
    <p>A <emph>document order</emph> is defined on all the nodes in a 
    document.  The document node is the first node.  Element nodes, 
    comment nodes, and processing instruction nodes occur in the 
    order of their representation in the XML (after expansion of 
    entities).  Element nodes occur before their children.  The 
    namespace nodes of an element immediately follow the element node
    (see <specref ref="Issue-0051"/>).
    The relative order of namespace nodes is implementation-dependent. 
    The attribute nodes of an element immediately follow the 
    namespace nodes of the element. The relative order of attribute 
    nodes is 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, given 
    two distinct documents A and B, if a node in document A is 
    before a node in document B, then every node in document A 
    is before every node in document B.</p>

    <note><p>The relative order of free-floating nodes (those not in
    a document) is not defined.  See <specref ref="Issue-0050"/>.</p></note>

    <p>The <emph>dm:node-before</emph> function takes two nodes as arguments.
    It returns true if the first argument is before (but not identical
    to) the second one in document order and false otherwise
    </p>

    <p role="definition">
function dm:node-before(<loc href="#Node">Node</loc> $n1, <loc href="#Node">Node</loc> $n2) returns <loc href="#dt-atomic-value">xs:boolean</loc>
    </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.  
    </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 XML documents that are not supported by
    the XML Information Set, for example, non-well-formed documents and documents
    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.
    See <specref ref="Issue-0024"/>.</p>

    <note><p>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.  See issue <specref ref="Issue-0004"/>.</p></note>

  </div2>
  
  <div2 id="types">
    <head>Types</head>
    <p>
    The data model supports a representation of named types as
    expanded-QNames.
    Named types include both the built-in types defined by XML Schema
    Part 2 and types declared in a schema and imported by a query.
    Since named types in XML Schema are global, an expanded-QName
    uniquely identifies such a type, be it simple or complex:
    The namespace of the expanded-QName is the target namespace
    of the schema and its local name is the name of the type.

    The data model does not uniquely identify anonymous types and
    represents them by xs:anyType or xs:anySimpleType. 
    </p>

    <ednote><edtext>
    The usage of xs:unknownType or xs:anyType is currently under discussion.
    An alternative is to represent named types by an optional expanded-QName
    and use the empty sequence instead of xs:unknownType or xs:anyType.
    </edtext></ednote>

    <p>
    The data model associates type information with element nodes
    attribute nodes and atomic values. If this type information
    is something other than xs:anyType or xs:anySimpleType, the item is
    guaranteed to be a valid instance of that type as defined by XML Schema.

    The data model defines an accessor <emph>dm:type()</emph> that returns
    an expanded-QName corresponding to the type of the element node,
    attribute node or atomic value, provided that the type is globally
    declared. It returns xs:anyType or xs:anySimpleType if it is
    locally declared or if no type information exists.
    When no type information exists for an element or an attribute node
    we frequently use the terminology "element with unknown type"
    or "attribute with unknown simple type".
    </p>

    <p>
    The data model does not represent element or attribute declaration
    schema components, but it supports various type-related operations.
    The semantics of such operations, e.g. checking if a particular 
    instance of an element node has a given type is defined in
    <bibref ref="XQFS"/>.
    </p>
  </div2>

  <div2>
    <head>Mapping PSV Infoset additions to Types</head>
  
    <p>This section specifies how the type of an element 
    or attribute node is computed from the PSV Infoset additions 
    that specify validity and type assessment for the node's corresponding 
    information item.</p>
  
    <p>A PSV element (attribute) information item has a 
    <emph role="infoset-property">validity</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>
    and reflects the outcome of the element's (attribute's)
    schema-validity assessment.
    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.
    Roughly speaking these two properties are used to compute the
    type of an element or attribute in the data model, which
    corresponds to the {target namespace} and the {name}
    of the <emph role="infoset-property">type definition</emph>
    property if <emph role="infoset-property">validity</emph> is 
    <emph>"valid"</emph>, or to xs:anyType (xs:anySimpleType) otherwise.
    Notice that 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 some general
    type information with the element or attribute node.
    </p>
  
    <p>
    The precise definition of the type of an element or attribute
    information item is slightly more complex due to the following
    factors.
    First, XML Schema only guarantees the existence of either the
    <emph role="infoset-property">type definition</emph> property,
    or the 
    <emph role="infoset-property">type definition namespace</emph>,
    <emph role="infoset-property">type definition name</emph> and
    <emph role="infoset-property">type definition anonymous</emph>
    properties.
    Second, if the type definition refers to a union type, there
    are further properties defined, that refer to the type definition
    which actually validated the element item's normalized value.
    These properties are either the
    <emph role="infoset-property">member type definition</emph>,
    or the 
    <emph role="infoset-property">member type definition namespace</emph>,
    <emph role="infoset-property">member type definition name</emph> and
    <emph role="infoset-property">member type definition anonymous</emph>
    properties.
    If these are available the type of an element or attribute will
    refer to the member type that actually validated the schema
    normalized value.
    Having identified all the relevant properties we can now define
    how to compute a type.
    </p>
  
    <p>
    The <emph>type</emph> of an element information item is
    represented by an xs:QName whose namespace and local name corresponds
    to the first applicable item in the following list:
    </p>
    <ulist>
    <item><p>
    xs:anyType if the <emph role="infoset-property">validity</emph>
    property is <emph>"invalid"</emph> or <emph>"notKnown"</emph>, or
    </p></item>
    <item><p>
    the {target namespace} and {name} properties of the
    <emph role="infoset-property">member type definition</emph>
    schema component if that exists, or
    </p></item>
    <item><p>
    the {target namespace} and {name} properties of the
    <emph role="infoset-property">type definition</emph>
    schema component if that exists, or
    </p></item>
    <item><p>
    the <emph role="infoset-property">member type definition namespace</emph>
    and the <emph role="infoset-property">member type definition name</emph>
    if <emph role="infoset-property">member type definition anonymous</emph>
    exists and is false, or
    </p></item>
    <item><p>
    the <emph role="infoset-property">type definition namespace</emph>
    and the <emph role="infoset-property">type definition name</emph>
    if <emph role="infoset-property">type definition anonymous</emph>
    exists and is false, or
    </p></item>
    <item><p>
    it corresponds to xs:anyType.
    </p></item>
    </ulist>

    <p>The <emph>type</emph> of an attribute information item is
    represented by an xs:QName. Its definition is the same as for
    element information items except for using xs:anySimpleType
    instead of xs:anyType above.</p>

    <p>We will find it convenient to define the following function
    that will be used later in various sections.
    The <emph>infoitem-to-type</emph> function takes an element or
    an attribute information item and returns an xs:QName that
    corresponds to the type of its argument. </p>
  
    <p id="infoitem-to-type" role="definition">
function infoitem-to-type((<loc href="#ElementItem">ElementItem</loc>|<loc href="#AttributeItem">AttributeItem</loc>) $ii) returns <loc href="#dt-atomic-value">xs:QName</loc>

define function infoitem-to-type(ElementItem $ii)
{
   if (psvi-element-validity($ii) ne "valid") then
      return <loc href="#xf_QName-from-string">xf:QName-from-string</loc>("xs:anyType") 
   else if (psvi-element-member-type-definition($ii) ne ()) then
      let $typedef:= psvi-element-member-type-definition($ii)
      let $name:= psvi-typedefinition-name($typedef)
      let $namespace:=  psvi-typedefinition-namespace($typedef)
      return <loc href="#xf_QName-from-uri">xf:QName-from-uri</loc>($namespace,$name) 
   else if (psvi-element-type-definition($ii) ne ()) then
      let $typedef:= psvi-element-type-definition($ii)
      let $name:= psvi-typedefinition-name($typedef)
      let $namespace:=  psvi-typedefinition-namespace($typedef)
      return <loc href="#xf_QName-from-uri">xf:QName-from-uri</loc>($namespace,$name) 
   else if (psvi-element-member-type-definition-anonymous($ii) eq false) then
      let $name:= psvi-element-member-type-definition-name($ii)
      let $namespace:= psvi-element-member-type-definition-namespace($ii)
      return <loc href="#xf_QName-from-uri">xf:QName-from-uri</loc>($namespace,$name) 
   else if (psvi-element-type-definition-anonymous($ii) eq false) then
      let $name:= psvi-element-type-definition-name($ii)
      let $namespace:= psvi-element-type-definition-namespace($ii)
      return <loc href="#xf_QName-from-uri">xf:QName-from-uri</loc>($namespace,$name) 
   else 
      return <loc href="#xf_QName-from-string">xf:QName-from-string</loc>("xs:anyType") 
}

function infoitem-to-type(AttributeItem $ii)
{
   if (psvi-attribute-validity($ii) ne "valid") then
      return <loc href="#xf_QName-from-string">xf:QName-from-string</loc>("xs:anySimpleType") 
   else if (psvi-attribute-member-type-definition($ii) ne ()) then
      let $typedef:= psvi-attribute-member-type-definition($ii)
      let $name:= psvi-typedefinition-name($typedef)
      let $namespace:=  psvi-typedefinition-namespace($typedef)
      return <loc href="#xf_QName-from-uri">xf:QName-from-uri</loc>($namespace,$name) 
   else if (psvi-attribute-type-definition(a) ne ()) then
      let $typedef:= psvi-attribute-type-definition($ii)
      let $name:= psvi-typedefinition-name($typedef)
      let $namespace:=  psvi-typedefinition-namespace($typedef)
      return <loc href="#xf_QName-from-uri">xf:QName-from-uri</loc>($namespace,$name) 
   else if (psvi-attribute-member-type-definition-anonymous($ii) eq false) then
      let $name:= psvi-attribute-member-type-definition-name($ii)
      let $namespace:= psvi-attribute-member-type-definition-namespace($ii)
      return <loc href="#xf_QName-from-uri">xf:QName-from-uri</loc>($namespace,$name) 
   else if (psvi-attribute-type-definition-anonymous($ii) eq false) then
      let $name:= psvi-attribute-type-definition-name($ii)
      let $namespace:= psvi-attribute-type-definition-namespace($ii)
      return <loc href="#xf_QName-from-uri">xf:QName-from-uri</loc>($namespace,$name) 
   else 
      return <loc href="#xf_QName-from-string">xf:QName-from-string</loc>("xs:anySimpleType") 
}
    </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>

  </div2>

<div2 id="textnodes">
  <head>Text Nodes and Sequences of Atomic Values</head>

  <p>The data model supports two representations of the character data
  that appears as element content: text nodes or a sequence of atomic values.
  Similarly, character data of attributes can also be represented in two
  ways: as a string or a sequence of atomic values.
  
  A text node represents a string of consecutive character information
  items and never has another text node as its immediately following sibling.
  An element node, for example, has child nodes 
  that may include text nodes, comment nodes, processing instruction nodes, 
  and other element nodes.  In addition, the text content of an element may be 
  interpreted as a sequence of atomic values, such as an integer, a date, or a
  sequence of prices.  To illustrate, consider an element node whose 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 atomic value 
  is a sequence containing the double-precision numbers 12.0 and 13.0.</p>

  <p>It is noted that the two representations of character data are not
  equivalent. A sequence of atomic values contains more type information
  then a text-node or string representation when the atomic values are 
  of different types (e.g. a sequence containing an integer, a date and a
  string). Since the text node child does not contain enough type
  information to reconstruct this typed value, an implementation must
  store the element's typed value separately from the text node.
  This precludes a "text node only" implementation.</p>

  <!--
  <p>The data model logically supports both text nodes and atomic 
  values, but it does not specify that they both must be implemented.  
  An implementation might choose to only store atomic values and 
  reconstruct text nodes on demand, or vice versa.  This allows for the
  efficient storage of and access to atomic values but it has an impact 
  on interoperability; for instance, searching for leading zeros in nodes 
  with numerical atomic values may yield results in some implementations 
  but not in others.</p>
  -->

</div2>

<div2 id="flags">
  <head>Ignoring Comments, Processing Instructions, and Whitespace</head>

  <p>Although the data model is able to represent comments, processing 
  instructions, and insignificant whitespace, preservation of this information 
  may be unnecessary and onerous for some applications.</p>

  <p>Construction of a document from an XML information set is 
  parameterized by three flags, <emph>ignore-comments</emph>,
  <emph>ignore-processing-instructions</emph>, and <emph>ignore-whitespace</emph>.  
  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 whitespace is not preserved.</p>

<p role="definition">
ignore-comments                : xs:boolean
ignore-processing-instructions : xs:boolean
ignore-whitespace              : xs:boolean
</p>

  <note><p>By whom these flags are set is not defined.  
  See <specref ref="Issue-0040"/>.</p></note>
  
  <p>Expressions which rely upon the presence or absence of comments, 
  processing instructions, or insignificant whitespace may produce different 
  results for two data models created from the same infoset (XML document), 
  when each data model is constructed with different settings of these flags.</p>

  <p>Insignificant whitespace is defined as a text node that:</p>
  <olist>
    <item><p>contains no characters other than whitespace 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>
  
  <note><p>See <specref ref="Issue-0034"/>.  Removal of insignificant whitespace 
  might be performed automatically when consistent with the schema.  See 
  <specref ref="Issue-0028"/>.  XSLT's whitespace handling mechanism needs
  to be supported; see <specref ref="Issue-0057"/>.</p></note>
</div2>

</div1>

<div1 id="Node">
  <head>Nodes</head>

  <p>The category of <emph>Node</emph> values contains seven 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>, and
  <loc href="#CommentNode">comment</loc>.  The seven kinds of nodes are 
  defined in the following subsections.</p>
  
  <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>A set of accessors is defined on all seven kinds of Nodes.  Some 
  accessors return a constant empty sequence on certain node kinds.</p>
  
  <ulist>
    <item>
      <p>The <emph>dm:node-kind</emph> accessor returns a string value 
      representing the node's kind: either <code>"document"</code>, 
      <code>"element"</code>, <code>"attribute"</code>, <code>"text"</code>, 
      <code>"namespace"</code>, <code>"processing-instruction"</code>, or
      <code>"comment"</code>.</p>
    </item>
    <item>
      <p>The <emph>dm:name</emph> accessor returns a sequence containing
      one <emph>expanded QName</emph> for node kinds that can have names.
      For other node kinds, it always returns an empty sequence.
      An expanded QName is in the value space of <emph>xs:QName</emph>, 
      and consists of a namespace URI and a local name.  See 
      <specref ref="Issue-0063"/>, <specref ref="Issue-0070"/>.</p>
    </item>
    <item>
      <p>The <emph>dm:base-uri</emph> accessor returns a sequence containing
      zero or one uri references for node kinds that can have a base-uri
      (document nodes and element nodes).  For other
      node kinds, it always returns the empty sequence.</p>
    </item>
    <item>
      <p>The <emph>dm:string-value</emph> accessor returns the node's 
      string representation.  For some kinds of nodes, this is part of
      the node; for other kinds of nodes, it is computed from the 
      <emph>dm:string-value</emph> of its descendant nodes.</p>
    </item>
    <item>
      <p>The <emph>dm:typed-value</emph> accessor returns a sequence of
      atomic values corresponding to the node. This may be a
      non-empty sequence for element and attribute nodes, but it is always
      the empty sequence for other node kinds.</p>
    </item>
    <item>
      <p>The <emph>dm:parent</emph> accessor returns a sequence containing
      zero or one nodes for node kinds that can have parents.  For other
      node kinds, it always returns the empty sequence.
      Every node has at most one parent, 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.</p>
      <note>
        <p>In XPath 1.0, Namespace nodes have parents.</p>
      </note>
    </item>
    <item>
      <p>The <emph>dm:children</emph> accessor returns a sequence containing
      zero or more nodes for node kinds that can have children (document
      nodes and element nodes).  For other node kinds, it always returns
      the empty sequence.
      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>
    </item>
    <item>
      <p>The <emph>dm:attributes</emph> accessor returns a sequence containing
      zero or more attribute nodes for element nodes.  For other node kinds,
      it always returns the empty sequence. </p>
    </item>
    <item>
      <p>The <emph>dm:namespaces</emph> accessor returns a sequence containing
      zero or more namespace nodes corresponding to the in-scope namespaces
      for element nodes.
      For other node kinds, it always returns the empty sequence. </p>
    </item>
    <item>
      <p>The <emph>dm:type</emph> accessor returns a sequence containing one
      expanded-QName corresponding to the type of the element node or
      attribute node, provided that the type is globally declared. It
      returns xs:anyType or xs:anySimpleType if it is locally declared
      or if no type information exists.  For other node kinds, it always
      returns the empty sequence. </p>
    </item>
    <item>
      <p>The <emph>dm:unique-ID</emph> accessor returns a sequence containing
      zero or one ID for element nodes.  For other node kinds,
      it always returns the empty sequence. </p>
    </item>
  </ulist>

  <p>The return types of the Node accessors are given below.  Some kinds of nodes
  further restrict the return types; notably, many node kinds return a
  constant empty sequence for some of the accessors.</p>

  <p role="definition">
function dm:node-kind(Node $n)    returns <loc href="#dt-atomic-value">xs:string</loc>
function dm:name(Node $n)         returns <loc href="#dt-atomic-value">xs:QName</loc>?
function dm:base-uri(Node $n)     returns <loc href="#dt-atomic-value">xs:anyURI</loc>?
function dm:string-value(Node $n) returns <loc href="#dt-atomic-value">xs:string</loc>
function dm:typed-value(Node $n)  returns <loc href="#AtomicValue">AtomicValue</loc>*
function dm:parent(Node $n)       returns (<loc href="#ElementNode">ElementNode</loc> | <loc href="#DocumentNode">DocumentNode</loc>)?
function dm:children(Node $n)     returns (<loc href="#ElementNode">ElementNode</loc> | <loc href="#TextNode">TextNode</loc>
                                           | <loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc>
                                           | <loc href="#CommentNode">CommentNode</loc>)*
function dm:attributes(Node $n)   returns <loc href="#AttributeNode">AttributeNode</loc>*
function dm:namespaces(Node $n)   returns <loc href="#NamespaceNode">NamespaceNode</loc>*
function dm:type(Node $n)         returns <loc href="#dt-atomic-value">xs:QName</loc>?
function dm:unique-ID(Node $n)    returns <loc href="#dt-atomic-value">xs:ID</loc>?
</p>

  <p>A tree contains a root plus all nodes that are reachable 
  directly or indirectly from the root via the <emph>dm:children</emph>, 
  <emph>dm:attributes</emph>, and <emph>dm: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>

<div2 id="DocumentNode">
  <head>Documents</head>

  <table role="node-summary">
    <thead>
      <tr><td>Document Node accessors</td><td>possible values</td></tr>
    </thead>
    <tbody>
      <tr><td>dm:node-kind</td>    <td>"document"</td></tr>
      <tr><td>dm:name</td>         <td>empty sequence</td></tr>
      <tr><td>dm:base-uri</td>     <td>xs:anyURI</td></tr>
      <tr><td>dm:string-value</td> <td>xs:string</td></tr>
      <tr><td>dm:typed-value</td>  <td>empty sequence</td></tr>
      <tr><td>dm:parent</td>       <td>empty sequence</td></tr>
      <tr><td>dm:children</td>     <td>arbitrary sequence of one or more 
                                element nodes, zero or more processing 
                                instruction nodes, and zero or more 
                                comment nodes</td></tr>
      <tr><td>dm:attributes</td>   <td>empty sequence</td></tr>
      <tr><td>dm:namespaces</td>   <td>empty sequence</td></tr>
      <tr><td>dm:type</td>         <td>empty sequence</td></tr>
      <tr><td>dm:unique-ID</td>    <td>empty sequence</td></tr>
    </tbody>
  </table>

  <p>A document is represented by a document node, which corresponds 
  to a <emph role="info-item">document information item</emph>.</p>

  <note>
    <p>Document nodes and XPath 1.0 root nodes are essentially 
    identical.</p>
  </note>
  
  <p>A document node does not have an <emph>expanded-QName</emph>.</p> 

  <p>The <emph>dm:base-uri</emph> of the document corresponds to the
  <emph role="infoset-property">base URI</emph> property.</p>

  <p>The <emph>dm: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>dm:parent</emph> of the document node is always the empty 
  sequence.  A document node always represents the root of a tree.</p>

  <p>The <emph>dm: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>

  <note><p>There is no way to determine what DTD might apply to the data model.
  See <specref ref="Issue-0042"/>.</p></note>

  <p>In a well-formed document, the children of the document node consist
  exclusively of element nodes, processing-instruction nodes, and 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>

  <note><p>See <specref ref="Issue-0041"/> and <specref ref="Issue-0074"/>.</p></note>
  
  <p id="document-node">
  A document node has the constructor <emph>dm:document-node</emph>, 
  which takes a base URI value and a non-empty sequence of its children nodes.
  Like all other node constructors, the document-node constructor has the
  effect of creating a new node with a unique identity, distinct from all
  other nodes.</p>

  <p role="definition">
function dm:document-node(
           <loc href="#dt-atomic-value">xs:anyURI</loc> $baseuri,
           (<loc  href="#ElementNode">ElementNode</loc> | <loc href="#TextNode">TextNode</loc> | <loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc>
            | <loc href="#CommentNode">CommentNode</loc>)+ $children) 
         returns <loc href="#DocumentNode">DocumentNode</loc>
  </p>

  <p>The accessors <emph>dm:base-uri</emph> and <emph>dm:children</emph> return a 
  document node's constituent parts:</p>

<p role="definition">
function dm:base-uri(<loc href="#DocumentNode">DocumentNode</loc> $n) returns <loc href="#dt-atomic-value">xs:anyURI</loc>
function dm:children(<loc href="#DocumentNode">DocumentNode</loc> $n) 
         returns (<loc href="#ElementNode">ElementNode</loc> | <loc href="#TextNode">TextNode</loc> 
                  | <loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc> | <loc href="#CommentNode">CommentNode</loc>)+
</p>
  
  <p>The accessors <emph>dm:node-kind</emph> and <emph>dm:string-value</emph>
  also apply to document nodes and return results other than the empty sequence.
  The accessors <emph>dm:name</emph>, <emph>dm:typed-value</emph>,
  <emph>dm:parent</emph>, <emph>dm:attributes</emph>, <emph>dm:namespaces</emph>,
  <emph>dm:type</emph> and <emph>dm:unique-ID</emph>
  applied to a document node always return the empty sequence.</p>

  <p>A document node is constructed from a Document Information
  Item by the <emph>infoitem-to-document-node</emph> function:</p>

<p role="definition" id="DocumentItem">
/* Accessors for document information items: */
function infoset-document-children(<loc href="#DocumentItem">DocumentItem</loc> $ii) 
         returns (<loc href="#ElementItem">ElementItem</loc> | <loc href="#ProcessingInstructionItem">ProcessingInstructionItem</loc> 
                  | <loc href="#CommentItem">CommentItem</loc> | DocTypeItem)*
function infoset-document-base-uri(<loc href="#DocumentItem">DocumentItem</loc> $ii) returns <loc href="#dt-atomic-value">xs:anyURI</loc>
</p>

<p role="definition" id="infoitem-to-document-node">
define function infoitem-to-document-node(<loc href="#DocumentItem">DocumentItem</loc> $ii) returns <loc href="#DocumentNode">DocumentNode</loc>
{ 
  let $kids:= <loc href="#collapse-text-nodes">collapse-text-nodes</loc>(<loc href="#sequence-map">sequence-map</loc>(infoitem-to-node,
                                  infoset-document-children($ii)))
  return <loc href="#DocumentNode">dm:document-node</loc>(infoset-document-base-uri($ii), $kids)
}
</p>


  <p>The <code><loc href="#collapse-text-nodes">collapse-text-nodes</loc></code>
  function synthesizes a single text node from multiple text nodes.  The 
  <code><loc href="#sequence-map">sequence-map</loc></code> 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.  In the pseudo-code
  above, <code>infoitem-to-node</code> is applied to each child of the 
  <emph role="info-item">document information item</emph>  
  <emph>$ii</emph> and a new sequence of children nodes is constructed, 
  each of which is a <emph>Node</emph>.  The constructor 
  <code>dm:document-node</code> constructs the document node in the data 
  model.</p>

  <p role="definition" id="sequence-map">
function sequence-map(<emph>function</emph> $map, <emph>Item</emph>* $seq) returns <emph>Item</emph>*</p>

  <p>The <emph>infoitem-to-node</emph> function maps an information item 
  to a sequence of zero or one node.</p>
  
  <p id="infoitem-to-node" role="definition">
define function infoitem-to-node(<loc href="#InfoItem">InfoItem</loc> $ii) returns Node?
{ 
  return
    if (infoitem-kind($ii) = "element") then 
      <loc href="#infoitem-to-element-node">infoitem-to-element-node</loc>($ii)
    else if (infoitem-kind($ii) = "character") then 
      <loc href="#infoitem-to-single-character-text-node">infoitem-to-single-character-text-node</loc>($ii)
    else if (infoitem-kind($ii) = "processing-instruction") then
      if (not(ignore-processing-instructions)) then 
        <loc href="#infoitem-to-processing-instruction-node">infoitem-to-processing-instruction-node</loc>($ii)
      else <loc href="#empty-sequence">empty-sequence</loc>()
    else if (infoitem-kind($ii) = "comment") then
      if (not(ignore-comments)) then 
        <loc href="#infoitem-to-comment-node">infoitem-to-comment-node</loc>($ii)
      else <loc href="#empty-sequence">empty-sequence</loc>()
    else 
      {-- infoitem-kind($ii) = "doctype" | "notation" | "unparsed-entity" --}
      <loc href="#empty-sequence">empty-sequence</loc>()
}</p>
</div2>

<div2 id="ElementNode">
  <head>Elements</head>

   <table role="node-summary">
    <thead>
      <tr><td>Element Node accessors</td><td>possible values</td></tr>
    </thead>
    <tbody>
      <tr><td>dm:node-kind</td>    <td>"element"</td></tr>
      <tr><td>dm:name</td>         <td>xs:QName</td></tr>
      <tr><td>dm:base-uri</td>     <td>xs:anyURI</td></tr>
      <tr><td>dm:string-value</td> <td>xs:string</td></tr>
      <tr><td>dm:typed-value</td>  <td>sequence of zero or more atomic values</td></tr>
      <tr><td>dm:parent</td>       <td>sequence of zero or one element or document node</td></tr>
      <tr><td>dm:children</td>     <td>sequence of zero or more element nodes, 
                                zero or more processing instruction nodes, 
                                zero or more comment nodes, and zero or more
                                text nodes</td></tr>
      <tr><td>dm:attributes</td>   <td>sequence of zero or more attribute nodes</td></tr>
      <tr><td>dm:namespaces</td>   <td>sequence of zero or more namespace nodes</td></tr>
      <tr><td>dm:type</td>         <td>xs:QName</td></tr>
      <tr><td>dm:unique-ID</td>    <td>zero or one xs:ID</td></tr>
    </tbody>
  </table>

  <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 URI of the <emph>expanded-QName</emph> of the element node
  corresponds to the <emph role="infoset-property">namespace name</emph>
  property.</p>
  
  <p>The <emph>dm:parent</emph> of the element node corresponds to the node
  corresponding to the <emph role="infoset-property">parent</emph> property.</p>

  <p>An element node has an associated <emph>dm:typed-value</emph>,
  which is a sequence of zero or more atomic values. Examples of such
  values would be a sequence containing an integer, or an atomic value
  of some user-defined type or several dates, etc.
  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 that exists, or the empty sequence otherwise.
  But if the element node has a complex type with complex
  content then <emph>dm:typed-value</emph> returns the error value.
  Furthermore, if the type of the element node is xs:anyType or
  xs:anySimpleType then <emph>dm:typed-value</emph> returns its string
  value with unknown simple type.
  In particular this implies the following:
  If an element was created with an xsi:nil attribute set to true,
  then its <emph>dm:typed-value</emph> is the empty sequence.
  For an element in a well-formed document with no associated schema,
  the element's <emph>dm:typed-value</emph> is its string value with
  unknown simple type.  See <specref ref="Issue-0071"/>.</p>

  <p>The <emph>dm:children</emph> 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>dm: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>dm: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.
  See <specref ref="Issue-0062"/>.</p>

  <p>The <emph>dm:type</emph> of an element is an xs:QName and
  its namespace and local name correspond to the following:
  </p>
  <ulist>
  <item><p>
  xs:anyType if the <emph role="infoset-property">validity</emph>
  property is <emph>"invalid"</emph> or <emph>"notKnown"</emph>, or
  </p></item>
  <item><p>
  the {target namespace} and {name} properties of the
  <emph role="infoset-property">member type definition</emph>
  schema component if that exists, or
  </p></item>
  <item><p>
  the {target namespace} and {name} properties of the
  <emph role="infoset-property">type definition</emph>
  schema component if that exists, or
  </p></item>
  <item><p>
  the <emph role="infoset-property">member type definition namespace</emph>
  and the <emph role="infoset-property">member type definition name</emph>
  if <emph role="infoset-property">member type definition anonymous</emph>
  exists and is false, or
  </p></item>
  <item><p>
  the <emph role="infoset-property">type definition namespace</emph>
  and the <emph role="infoset-property">type definition name</emph>
  if <emph role="infoset-property">type definition anonymous</emph>
  exists and is false, or
  </p></item>
  <item><p>
  it corresponds to xs:anyType.
  </p></item>
  </ulist>
  <p>
  It is noted that if the type referenced would be a union type then
  type refers to the member type that actually validated the
  schema normalized value.
  See <specref ref="Issue-0064"/>.</p>

  <p>The <emph>unique ID</emph> of the element node is an identifier
  optionally assigned by the user.  It 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>, if one exists.</p>

  <note><p>Using this definition, only IDs declared in a DTD are effective.
  See <specref ref="Issue-0004"/>.  Even so, this definition is not
  backward compatible with XPath 1.0.  See <specref ref="Issue-0038"/>.
  Furthermore, it doesn't even work as spec'd, see <specref ref="Issue-0044"/>.</p></note>
  
  <p>An element node can be constructed in one of two
  ways: <emph>dm:element-node</emph> is useful for constructing an element
  from the PSVI, <emph>dm:element-node-atomic</emph> is useful when
  constructing an element via embedded expressions. The difference in
  the constructors is whether the children of the node are specified
  as a sequence of nodes or as a sequence of atomic values.</p>

  <p id="element-node">The constructor
  <emph>dm:element-node</emph> takes an expanded-QName, 
  a sequence of namespace nodes, a sequence of attribute nodes, a 
  sequence of child nodes, and the node's type.</p>
  
  <p role="definition">
function dm:element-node(
           <loc href="#dt-atomic-value">xs:QName</loc> $qname, 
           <loc href="#NamespaceNode">NamespaceNode</loc>* $nsnodes,
           <loc href="#AttributeNode">AttributeNode</loc>* $attrnodes, 
           (<loc href="#ElementNode">ElementNode</loc> | <loc href="#TextNode">TextNode</loc> | <loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc> 
            | <loc href="#CommentNode">CommentNode</loc>)* $children, 
           <loc href="#dt-atomic-value">xs:QName</loc> $type)
         returns <loc href="#ElementNode">ElementNode</loc>
  </p>

  <p id="element-node-atomic">The constructor <emph>dm:element-node-atomic</emph>
  takes an expanded-QName, 
  a sequence of namespace nodes, a sequence of attribute nodes, a 
  sequence of atomic values, and the node's type.</p>
  
  <p role="definition">
function dm:element-node-atomic(
           <loc href="#dt-atomic-value">xs:QName</loc> $qname, 
           <loc href="#NamespaceNode">NamespaceNode</loc>* $nsnodes,
           <loc href="#AttributeNode">AttributeNode</loc>* $attrnodes, 
           <loc href="#AtomicValue">AtomicValue</loc>* $values, 
           <loc href="#dt-atomic-value">xs:QName</loc> $type)
         returns <loc href="#ElementNode">ElementNode</loc>
  </p>

  <p>Like all other node constructors, the element node
  constructors has the effect of creating a new node with a unique 
  identity, distinct from all other nodes.</p>

  <p>To guarantee that the parent-child relationship is 
  invertible, the element constructors logically create a copy of all of their 
  namespace, attribute, and children arguments and set 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.  See <specref ref="Issue-0052"/>.</p>
  
  <note><p>An alternative interface is suggested by James Clark:
  See <specref ref="Issue-0019"/>.</p></note>

  <p>Neither constructor allows specifying the children of the node
  as a heterogeneous sequence, i.e. a sequence mixing nodes and atomic
  values. It is still possible to construct an element (with
  mixed content) from such a sequence in two steps:
  First the heterogeneous sequence will need to be turned into a
  homogeneous one by converting the atomic values to text nodes,
  then the now homogeneous sequence can be passed to the
  element-node constructor.
  Note that the precise type information of the atomic values is
  lost in the process, which is inline with XML Schema, that cannot
  represent the type of such mixed content.
  </p>

<!--
  <ednote><edtext>Both element constructors take a SchemaComponent as one of
  their arguments. The question of what should the value of this argument
  be when no type information is available (for instance when dealing
  with well formed, schemaless documents) and how should the typed-value
  accessor behave in these cases is currently under discussion.
  See also <specref ref="Issue-0036"/>.</edtext></ednote>
-->

  <p>The accessors <emph>dm:name</emph>, <emph>dm:namespaces</emph>,
  <emph>dm:attributes</emph> and <emph>dm:type</emph> return an
  element node's constituent parts.
  The <emph>dm:children</emph> accessor returns the sequence of children
  nodes for an element node if it was created with <emph>dm:element-node</emph>
  and it returns a singleton sequence containing a text node corresponding
  to the sequence of atomic values if it was created with
  <emph>dm:element-node-atomic</emph>.
  The string value of the text node in the latter case is the string
  value of the sequence of atomic values, which is obtained by inserting
  a #x20 (space) separator between the dm:string-values of the individual
  atomic values and concatenating the result (as defined in
  <specref ref="sequences"/>).
  See <specref ref="Issue-0068"/>.
</p>
  
  <p role="definition">
function dm:name(<loc href="#ElementNode">ElementNode</loc> $n)       returns <loc href="#dt-atomic-value">xs:QName</loc>
function dm:namespaces(<loc href="#ElementNode">ElementNode</loc> $n) returns <loc href="#namespace-node">NamespaceNode</loc>*
function dm:attributes(<loc href="#ElementNode">ElementNode</loc> $n) returns <loc href="#AttributeNode">AttributeNode</loc>*
function dm:children(<loc href="#ElementNode">ElementNode</loc> $n)   returns (<loc href="#ElementNode">ElementNode</loc> | <loc href="#TextNode">TextNode</loc>
                                                | <loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc>
                                                | <loc href="#comment-node">CommentNode</loc>)* 
function dm:type(<loc href="#ElementNode">ElementNode</loc> $n)       returns <loc href="#dt-atomic-value">xs:QName</loc>
  </p>

  <p>The accessor function <emph>dm:typed-value</emph> returns a sequence
  of zero or more atomic values. If the element was created with
  <emph>dm:element-node</emph>, <emph>dm:typed-value</emph> corresponds
  to the <emph role="infoset-property">schema normalized value</emph>
  PSVI property if that exists, or the empty sequence otherwise.
  But if the element node has a complex type with complex
  content then <emph>dm:typed-value</emph> returns the error value.
  Furthermore, if the type of the element node is xs:anyType or
  xs:anySimpleType then <emph>dm:typed-value</emph> returns its string
  value with unknown simple type.
  If the element was created with <emph>dm:element-node-atomic</emph>,
  <emph>dm:typed-value</emph> returns the sequence of atomic values
  that were used to construct the element.</p>
    
  <p role="definition">
function dm:typed-value(<loc href="#ElementNode">ElementNode</loc> $n) returns <loc href="#AtomicValue">AtomicValue</loc>*</p>

  <p>The <emph>dm:string-value</emph> of an element node returns the concatenation
  of the string-values of all text-node descendants of the element node in 
  document order if it was created with <emph>dm:element-node</emph>
  and it returns the string representation of the sequence of atomic values
  if it was created with <emph>dm:element-node-atomic</emph>. See <specref ref="Issue-0073"/>.</p>

  <p role="definition">function dm:string-value(<loc href="#ElementNode">ElementNode</loc> $n) returns <loc href="#dt-atomic-value">xs:string</loc></p>

  <p>If an element has a unique ID, the accessor function <emph>dm:unique-ID</emph> 
  returns a sequence containing the unique ID of the node; otherwise, it 
  returns the empty sequence.</p>
    
  <p role="definition">
function dm:unique-ID(<loc href="#ElementNode">ElementNode</loc> $n) returns <loc href="#dt-atomic-value">xs:ID</loc>?</p>

  <p>The node accessors <emph>dm:base-uri</emph>, <emph>dm:node-kind</emph>, 
  <emph>dm:parent</emph>, and <emph>dm:string-value</emph> also apply to
  element nodes.</p>

  <p>An element node is constructed from an Element Information
  Item by the <emph>infoitem-to-element-node</emph> function:</p>

  <p role="definition" id="ElementItem">
/* Accessors for element information items: */
function infoset-element-namespace-name(<loc href="#ElementItem">ElementItem</loc> $ii)       returns <loc href="#dt-atomic-value">xs:anyURI</loc>?
function infoset-element-local-name(<loc href="#ElementItem">ElementItem</loc> $ii)           returns <loc href="#dt-atomic-value">xs:string</loc>
function infoset-element-children(<loc href="#ElementItem">ElementItem</loc> $ii)             returns <loc href="#InfoItem">InfoItem</loc>*
function infoset-element-attributes(<loc href="#ElementItem">ElementItem</loc> $ii)           returns <loc href="#AttributeItem">AttributeItem</loc>*
function infoset-element-in-scope-namespaces(<loc href="#ElementItem">ElementItem</loc> $ii)  returns <loc href="#NamespaceItem">NamespaceItem</loc>*
function infoset-element-base-uri(<loc href="#ElementItem">ElementItem</loc> $ii)             returns <loc href="#dt-atomic-value">xs:anyURI</loc>

function psvi-element-validity(<loc href="#ElementItem">ElementItem</loc> $ii)                returns xs:string
function psvi-element-type-definition(<loc href="#ElementItem">ElementItem</loc> $ii)         returns <loc href="#ElementItem">ElementItem</loc>
function psvi-element-schema-normalized-value(<loc href="#ElementItem">ElementItem</loc> $ii) returns <loc href="#dt-atomic-value">xs:string</loc>
  </p>

  <p id="infoitem-to-element-node" role="definition">
define function infoitem-to-element-node(<loc href="#ElementItem">ElementItem</loc> $ii) returns <loc href="#ElementNode">ElementNode</loc>
{ 
  let $qname:= <loc href="#xf_QName-from-uri">xf:QName-from-uri</loc>(infoset-element-namespace-name($ii), 
                                 infoset-element-local-name($ii)),
      $nsnodes:= <loc href="#sequence-map">sequence-map</loc>(<loc href="#infoitem-to-namespace-node">infoitem-to-namespace-node</loc>, 
                              infoset-element-in-scope-namespaces($ii)),
      $attrnodes:= <loc href="#sequence-map">sequence-map</loc>(<loc href="#infoitem-to-attribute-node">infoitem-to-attribute-node</loc>,
                                infoset-element-attributes($ii)),
      $kids:= <loc href="#collapse-text-nodes">collapse-text-nodes</loc>(<loc href="#sequence-map">sequence-map</loc>(
                <loc href="#infoitem-to-node">infoitem-to-node</loc>, infoset-element-children($ii))),
      $type:= infoitem-to-type($ii)
  return <loc href="#element-node">dm:element-node</loc>($qname, $nsnodes, $attrnodes, $kids, $type)
}</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>
  -->

  <note><p>[base URI] is discarded.  See <specref ref="Issue-0030"/>.</p></note>

<!--
  <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>dm:typed-value</emph>.
  </edtext></ednote>
-->

<!--
  <p role="definition" id="infoitem-to-concat-string">
  /* The <emph>infoitem-to-concat-string</emph> function concatenates two strings */
  concat-string : (string, string) -> string
  </p>
-->
</div2>

<div2 id="AttributeNode">
  <head>Attributes</head>

   <table role="node-summary">
    <thead>
      <tr><td>Attribute Node accessors</td><td>possible values</td></tr>
    </thead>
    <tbody>
      <tr><td>dm:node-kind</td>    <td>"attribute"</td></tr>
      <tr><td>dm:name</td>         <td>xs:QName</td></tr>
      <tr><td>dm:base-uri</td>     <td>empty sequence</td></tr>
      <tr><td>dm:string-value</td> <td>xs:string</td></tr>
      <tr><td>dm:typed-value</td>  <td>sequence of zero or more atomic values</td></tr>
      <tr><td>dm:parent</td>       <td>sequence of zero or one element nodes</td></tr>
      <tr><td>dm:children</td>     <td>empty sequence</td></tr>
      <tr><td>dm:attributes</td>   <td>empty sequence</td></tr>
      <tr><td>dm:namespaces</td>   <td>empty sequence</td></tr>
      <tr><td>dm:type</td>         <td>xs:QName</td></tr>
      <tr><td>dm:unique-ID</td>    <td>empty sequence</td></tr>
    </tbody>
  </table>

  <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>dm:string-value</emph>,
  which corresponds to the
  <emph role="infoset-property">normalized value</emph> property.</p>

  <p>An attribute node also has a <emph>dm: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.
  But if the type of the attribute node is xs:anySimpleType then
  <emph>dm:typed-value</emph> returns its string value with unknown
  simple type.
  </p>

  <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>dm:parent</emph> of the attribute node 
  corresponds to the <emph role="infoset-property">owner element</emph> 
  property.</p>

  <p>The <emph>dm:type</emph> of an attribute is an xs:QName and
  its namespace and local name correspond to the following:</p>
  <ulist>
  <item><p>
  xs:anySimpleType if the <emph role="infoset-property">validity</emph>
  property is <emph>"invalid"</emph> or <emph>"notKnown"</emph>, or
  </p></item>
  <item><p>
  the {target namespace} and {name} properties of the
  <emph role="infoset-property">member type definition</emph>
  schema component if that exists, or
  </p></item>
  <item><p>
  the {target namespace} and {name} properties of the
  <emph role="infoset-property">type definition</emph>
  schema component if that exists, or
  </p></item>
  <item><p>
  the <emph role="infoset-property">member type definition namespace</emph>
  and the <emph role="infoset-property">member type definition name</emph>
  if <emph role="infoset-property">member type definition anonymous</emph>
  exists and is false, or
  </p></item>
  <item><p>
  the <emph role="infoset-property">type definition namespace</emph>
  and the <emph role="infoset-property">type definition name</emph>
  if <emph role="infoset-property">type definition anonymous</emph>
  exists and is false, or
  </p></item>
  <item><p>
  it corresponds to xs:anySimpleType.
  </p></item>
  </ulist>
  <p>
  It is noted that if the type referenced would be a union type then
  type refers to the member type that actually validated the
  schema normalized value.
  </p>

  <p>An attribute node can be constructed in one of two ways:
  <emph>dm:attribute-node</emph> is useful for constructing an attribute
  from the PSVI, <emph>dm:attribute-node-atomic</emph> is useful when
  constructing an attribute with embedded expressions.</p>

  <p id="attribute-node">The constructor
  <emph>dm:attribute-node</emph>
  takes the attribute's name, a string value and the attribute's type.</p>

  <p role="definition">
function dm:attribute-node(<loc href="#dt-atomic-value">xs:QName</loc> $qname, <loc href="#dt-atomic-value">xs:string</loc> $value, <loc href="#dt-atomic-value">xs:QName</loc> $type)
         returns <loc href="#AttributeNode">AttributeNode</loc></p>
  
  <p id="attribute-node-atomic">The constructor
  <emph>dm:attribute-node-atomic</emph> takes the attribute's name, a
  list of atomic values and the attribute's type.</p>

  <p role="definition">
function dm:attribute-node-atomic(<loc href="#dt-atomic-value">xs:QName</loc> $qname, <loc href="#AtomicValue">AtomicValue</loc>* $value, <loc href="#dt-atomic-value">xs:QName</loc> $type)
         returns <loc href="#AttributeNode">AttributeNode</loc></p>
  
  <p>Like all other node constructors, the attribute node
  constructors have the effect of creating a new node with a unique 
  identity, distinct from all other nodes.  </p>

<!--
  <ednote><edtext>Both attribute constructors take a SchemaComponent as one of
  their arguments. The question of what should the value of this argument
  be when no type information is available (for instance when dealing
  with well formed, schemaless documents) and how should the typed-value
  accessor behave in these cases is currently under discussion.
  See also <specref ref="Issue-0036"/>.</edtext></ednote>
-->

  <p>The accessors <emph>dm:name</emph> and <emph>dm:type</emph> return an
  attribute's constituent parts.
  The accessor <emph>dm:string-value</emph> returns an attribute's
  constituent part if it was created with <emph>dm:attribute-node</emph>
  and it returns the string representation of the sequence of atomic values
  if it was created with <emph>dm:attribute-node-atomic</emph>.
  The accessor function <emph>dm:typed-value</emph> returns 
  a sequence of the atomic values of an attribute.
  In particular if the type of the attribute node is xs:anySimpleType
  then <emph>dm:typed-value</emph> returns its string value with unknown
  simple type.
  </p>

  <p role="definition">
function dm:name(<loc href="#AttributeNode">AttributeNode</loc> $n)         returns <loc href="#dt-atomic-value">xs:QName</loc>
function dm:string-value(<loc href="#AttributeNode">AttributeNode</loc> $n) returns <loc href="#dt-atomic-value">xs:string</loc>
function dm:type(<loc href="#AttributeNode">AttributeNode</loc> $n)         returns <loc href="#dt-atomic-value">xs:QName</loc>
function dm:typed-value(<loc href="#AttributeNode">AttributeNode</loc> $n)  returns <loc href="#AtomicValue">AtomicValue</loc>*</p>

  <p>The node accessors <emph>dm:node-kind</emph> and <emph>dm:parent</emph>
  also apply to attribute nodes and may return results other than the
  empty sequence.
  The accessors <emph>dm:base-uri</emph>, <emph>dm:children</emph>,
  <emph>dm:attributes</emph>, <emph>dm:namespaces</emph> and <emph>dm:unique-ID</emph>
  applied to an attribute node always return the empty sequence.</p>

  <p>An attribute node is constructed from an Attribute Information
  Item by the <emph>infoitem-to-attribute-node</emph> function:</p>

  <p role="definition" id="AttributeItem">
/* Accessors for attribute information items: */
function infoset-attribute-namespace-name(<loc href="#AttributeItem">AttributeItem</loc> $ii)   returns <loc href="#dt-atomic-value">xs:anyURI</loc>?
function infoset-attribute-local-name(<loc href="#AttributeItem">AttributeItem</loc> $ii)       returns <loc href="#dt-atomic-value">xs:string</loc>
function infoset-attribute-normalized-value(<loc href="#AttributeItem">AttributeItem</loc> $ii) returns <loc href="#dt-atomic-value">xs:string</loc>
function infoset-attribute-owner-element(<loc href="#AttributeItem">AttributeItem</loc> $ii)    returns <loc href="#ElementItem">ElementItem</loc>

function psvi-attribute-validity(<loc href="#AttributeItem">AttributeItem</loc> $ii)                returns <loc href="#dt-atomic-value">xs:string</loc>
function psvi-attribute-type-definition(<loc href="#AttributeItem">AttributeItem</loc> $ii)         returns <loc href="#ElementItem">ElementItem</loc>
function psvi-attribute-schema-normalized-value(<loc href="#AttributeItem">AttributeItem</loc> $ii) returns <loc href="#dt-atomic-value">xs:string</loc>
  </p>

  <p role="definition" id="infoitem-to-attribute-node">
define function infoitem-to-attribute-node(<loc href="#AttributeItem">AttributeItem</loc> $ii) returns <loc href="#AttributeNode">AttributeNode</loc> 
{
  let $qname:= <loc href="#xf_QName-from-uri">xf:QName-from-uri</loc>(infoset-attribute-namespace-name($ii), 
                                 infoset-attribute-local-name($ii)),
      $type:= infoitem-to-type($ii)
  return <loc href="#attribute-node">dm:attribute-node</loc>($qname, infoset-attribute-normalized-value($ii), $type)
}
  </p>

  <ednote><edtext>JM: Update the above to accommodate the possibility of
  schema-less and DTD validation.</edtext></ednote>

</div2>

<div2 id="NamespaceNode">
  <head>Namespaces</head>

   <table role="node-summary">
    <thead>
      <tr><td>Namespace Node accessors</td><td>possible values</td></tr>
    </thead>
    <tbody>
      <tr><td>dm:node-kind</td>    <td>"namespace"</td></tr>
      <tr><td>dm:name</td>         <td>sequence of zero or one xs:QName</td></tr>
      <tr><td>dm:base-uri</td>     <td>empty sequence</td></tr>
      <tr><td>dm:string-value</td> <td>xs:string</td></tr>
      <tr><td>dm:typed-value</td>  <td>empty sequence</td></tr>
      <tr><td>dm:parent</td>       <td>empty sequence</td></tr>
      <tr><td>dm:children</td>     <td>empty sequence</td></tr>
      <tr><td>dm:attributes</td>   <td>empty sequence</td></tr>
      <tr><td>dm:namespaces</td>   <td>empty sequence</td></tr>
      <tr><td>dm:type</td>         <td>empty sequence</td></tr>
      <tr><td>dm:unique-ID</td>    <td>empty sequence</td></tr>
    </tbody>
  </table>

  <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 URI of the <emph>QName</emph> is the empty
  sequence.</p>

  <p>The <emph>dm:string-value</emph> of the namespace node corresponds to 
  the <emph role="infoset-property">namespace name</emph> property.</p>

  <p>A namespace node has no <emph>dm:parent</emph>.</p>

  <note><p>From XPath 1.0 : "The <emph>parent</emph> of the
  namespace node is the element node in whose namespaces collection
  this node appears."  See <specref ref="Issue-0039"/> and
  <specref ref="Issue-0060"/>, and <specref ref="Issue-0061"/>.</p></note>

<p id="namespace-node">
  A namespace node has the constructor
  <emph>dm:namespace-node</emph>, which takes a namespace prefix and 
  the absolute URI of the namespace being declared. The namespace prefix may
  be the empty sequence. If the URI is the zero-length string, the prefix must 
  be the empty sequence.
  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">
function dm:namespace-node(<loc href="#dt-atomic-value">xs:string</loc>? $prefix, <loc href="#dt-atomic-value">xs:string</loc> $uri) 
         returns <loc href="#NamespaceNode">NamespaceNode</loc></p>

  <p>A namespace node's constituent parts may be obtained by applying
  the accessors <emph>dm:name</emph> (with the function
  <loc href="#xf_get-local-name">xf:get-local-name</loc>) and
  <emph>dm:string-value</emph>.</p>

  <p role="definition">
function dm:name(<loc href="#NamespaceNode">NamespaceNode</loc> $n)         returns <loc href="#dt-atomic-value">xs:QName</loc>?
function dm:string-value(<loc href="#NamespaceNode">NamespaceNode</loc> $n) returns <loc href="#dt-atomic-value">xs:string</loc>
  </p>

  <p>The node accessor <emph>dm:node-kind</emph> also applies to namespace nodes
  and returns a result other than the empty sequence.
  The accessors <emph>dm:base-uri</emph>, <emph>dm:typed-value</emph>,
  <emph>dm:parent</emph>, <emph>dm:children</emph>, <emph>dm:attributes</emph>,
  <emph>dm:namespaces</emph>, <emph>dm:type</emph> and
  <emph>dm:unique-ID</emph> applied to a namespace node always return the empty
  sequence.</p>

  <p>A namespace node is constructed from a Namespace Information
  Item by the <emph>infoitem-to-namespace-node</emph> function:</p>

  <p role="definition" id="NamespaceItem">
function infoset-namespace-prefix(<loc href="#NamespaceItem">NamespaceItem</loc> $ii) returns <loc href="#dt-atomic-value">xs:string</loc>?
function infoset-namespace-namespace-name(<loc href="#NamespaceItem">NamespaceItem</loc> $ii) returns <loc href="#dt-atomic-value">xs:string</loc>
  </p>

  <p role="definition" id="infoitem-to-namespace-node">
define function infoitem-to-namespace-node(<loc href="#NamespaceItem">NamespaceItem</loc> $ii) returns <loc href="#NamespaceNode">NamespaceNode</loc> 
{
   return <loc href="#NamespaceNode">dm:namespace-node</loc>(infoset-namespace-prefix($ii),
                            infoset-namespace-namespace-name($ii))
}</p>
</div2>

<div2 id="ProcessingInstructionNode">
  <head>Processing Instructions</head>

   <table role="node-summary">
    <thead>
      <tr><td>Processing Instruction Node accessors</td><td>possible values</td></tr>
    </thead>
    <tbody>
      <tr><td>dm:node-kind</td>    <td>"processing-instruction"</td></tr>
      <tr><td>dm:name</td>         <td>xs:QName</td></tr>
      <tr><td>dm:base-uri</td>     <td>empty-sequence</td></tr>
      <tr><td>dm:string-value</td> <td>xs:string</td></tr>
      <tr><td>dm:typed-value</td>  <td>empty sequence</td></tr>
      <tr><td>dm:parent</td>       <td>sequence of zero or one element or document nodes</td></tr>
      <tr><td>dm:children</td>     <td>empty sequence</td></tr>
      <tr><td>dm:attributes</td>   <td>empty sequence</td></tr>
      <tr><td>dm:namespaces</td>   <td>empty sequence</td></tr>
      <tr><td>dm:type</td>         <td>empty sequence</td></tr>
      <tr><td>dm:unique-ID</td>    <td>empty sequence</td></tr>
    </tbody>
  </table>

  <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 URI 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>dm:string-value</emph> of the processing instruction node 
  corresponds to the <emph role="infoset-property">content</emph> 
  property.</p>

  <p>The <emph>dm: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>dm:processing-instruction-node</emph>, which takes an NCName
  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 role="definition">
function dm:processing-instruction-node(<loc href="#dt-atomic-value">xs:NCName</loc> $target, <loc href="#dt-atomic-value">xs:string</loc> $content)
         returns <loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc>
  </p>
  
  <p>A processing instruction's constituent parts may be obtained by applying
  the accessors <emph>dm:name</emph> (with the function
  <loc href="#xf_get-local-name">xf:get-local-name</loc>) and
  <emph>dm:string-value</emph>.</p>

  <p role="definition">
function dm:name(<loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc> $n)         returns <loc href="#dt-atomic-value">xs:QName</loc>
function dm:string-value(<loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc> $n) returns <loc href="#dt-atomic-value">xs:string</loc>
  </p>
  
  <p>The node accessors <emph>dm:node-kind</emph> and <emph>dm:parent</emph>
  also apply to processing-instruction nodes and may return results other
  than the empty sequence.
  The accessors <emph>dm:base-uri</emph>, <emph>dm:typed-value</emph>,
  <emph>dm:children</emph>, <emph>dm:attributes</emph>, <emph>dm:namespaces</emph>,
  <emph>dm:type</emph> and <emph>dm:unique-ID</emph>
  applied to a processing-instruction node always return the empty sequence.
  </p>

  <p>A processing-instruction node is constructed from an Processing
  Instruction Information Item by the <emph>infoitem-to-processing-instruction-node</emph> function:</p>

  <p role="definition" id="ProcessingInstructionItem">
/* Accessors for processing instruction information items */
function infoset-processing-instruction-target(<loc href="#ProcessingInstructionItem">ProcessingInstructionItem</loc> $ii)
         returns <loc href="#dt-atomic-value">xs:string</loc>
function infoset-processing-instruction-content(<loc href="#ProcessingInstructionItem">ProcessingInstructionItem</loc> $ii)
         returns <loc href="#dt-atomic-value">xs:string</loc>
</p>

  <p role="definition" id="infoitem-to-processing-instruction-node">
define function infoitem-to-processing-instruction-node(<loc href="#ProcessingInstructionItem">ProcessingInstructionItem</loc> $ii)
       returns <loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc> 
{
  return dm:processing-instruction-node(
           <loc href="#xf_NCName">xf:NCName</loc>(infoset-processing-instruction-target($ii)), 
           infoset-processing-instruction-content($ii))
}</p>
</div2>

<div2 id="CommentNode">
  <head>Comments</head>
  
   <table role="node-summary">
    <thead>
      <tr><td>Comment Node accessors</td><td>possible values</td></tr>
    </thead>
    <tbody>
      <tr><td>dm:node-kind</td>    <td>"comment"</td></tr>
      <tr><td>dm:name</td>         <td>empty sequence</td></tr>
      <tr><td>dm:base-uri</td>     <td>empty-sequence</td></tr>
      <tr><td>dm:string-value</td> <td>xs:string</td></tr>
      <tr><td>dm:typed-value</td>  <td>empty sequence</td></tr>
      <tr><td>dm:parent</td>       <td>sequence of zero or one element or document nodes</td></tr>
      <tr><td>dm:children</td>     <td>empty sequence</td></tr>
      <tr><td>dm:attributes</td>   <td>empty sequence</td></tr>
      <tr><td>dm:namespaces</td>   <td>empty sequence</td></tr>
      <tr><td>dm:type</td>         <td>empty sequence</td></tr>
      <tr><td>dm:unique-ID</td>    <td>empty sequence</td></tr>
    </tbody>
  </table>

  <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>dm:string-value</emph> of the comment node corresponds to 
  the <emph role="infoset-property">content</emph> property.</p>
  
  <p>The <emph>dm: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>dm: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">
function dm:comment-node(<loc href="#dt-atomic-value">xs:string</loc> $content) returns <loc href="#CommentNode">CommentNode</loc></p>

  <p>A comment node's constituent parts may be obtained by applying
  the accessor <emph>dm:string-value</emph>.</p>

  <p role="definition">
function dm:string-value(<loc href="#CommentNode">CommentNode</loc> $n) returns <loc href="#dt-atomic-value">xs:string</loc>
  </p>
  
  <p>The node accessors <emph>dm:node-kind</emph> and <emph>dm:parent</emph>
  also apply to comment nodes and may return results other than the empty
  sequence.
  The accessors <emph>dm:name</emph>, <emph>dm:base-uri</emph>,
  <emph>dm:typed-value</emph>, <emph>dm:children</emph>, <emph>dm:attributes</emph>,
  <emph>dm:namespaces</emph>, <emph>dm:type</emph> and
  <emph>dm:unique-ID</emph> applied to a comment node always return the empty
  sequence.</p>

  <p>A comment node is constructed from a Comment Information 
  Item by the <emph>infoitem-to-comment-node</emph> function:</p>

  <p role="definition" id="CommentItem">
/* Accessors for comment information items */
function infoset-comment-value(<loc href="#CommentItem">CommentItem</loc> $ii) returns <loc href="#dt-atomic-value">xs:string</loc>
</p>

<p role="definition" id="infoitem-to-comment-node">
define function infoitem-to-comment-node(<loc href="#CommentItem">CommentItem</loc> $ii) returns <loc href="#comment-node">CommentNode</loc> 
{
  return  <loc href="#CommentNode">dm:comment-node</loc>(infoset-comment-value($ii))
}
</p>
</div2>

<div2 id="TextNode">
  <head>Text</head>

   <table role="node-summary">
    <thead>
      <tr><td>Text Node accessors</td><td>possible values</td></tr>
    </thead>
    <tbody>
      <tr><td>dm:node-kind</td>    <td>"text"</td></tr>
      <tr><td>dm:name</td>         <td>empty sequence</td></tr>
      <tr><td>dm:base-uri</td>     <td>empty-sequence</td></tr>
      <tr><td>dm:string-value</td> <td>xs:string</td></tr>
      <tr><td>dm:typed-value</td>  <td>sequence containing one atomic value</td></tr>
      <tr><td>dm:parent</td>       <td>sequence of zero or one element or document nodes</td></tr>
      <tr><td>dm:children</td>     <td>empty sequence</td></tr>
      <tr><td>dm:attributes</td>   <td>empty sequence</td></tr>
      <tr><td>dm:namespaces</td>   <td>empty sequence</td></tr>
      <tr><td>dm:type</td>         <td>empty sequence</td></tr>
      <tr><td>dm:unique-ID</td>    <td>empty sequence</td></tr>
    </tbody>
  </table>

  <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>dm: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>

  <note><p>The string-value is not W3C normalized as described in the
  <loc href="http://www.w3.org/TR/charmod/#sec-TextNormalization">Character
  Model for the World Wide Web version 1.0</loc> draft.  See
  <specref ref="Issue-0045"/>.</p></note>

  <p>The <emph>dm: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>dm: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 role="definition">
function dm:text-node(<loc href="#dt-atomic-value">xs:string</loc> $content) returns <loc href="#TextNode">TextNode</loc></p>

  <p>The <emph>dm:string-value</emph> of a text node is simply its content.</p>

  <p role="definition">
function dm:string-value(<loc href="#TextNode">TextNode</loc> $n) returns <loc href="#dt-atomic-value">xs:string</loc>
  </p>
  
  <p>The <emph>dm:typed-value</emph> accessor returns the string content
  of the text node with unknown simple type.</p>
  
  <p role="definition">
define function dm:typed-value(<loc href="#TextNode">TextNode</loc> $n) returns <loc href="#AtomicValue">AtomicValue</loc>
{
  return <loc href="#AtomicValue">dm:atomic-value</loc>(dm:string-value($n),xs:anySimpleType)
}
</p>

  <p>The node accessors <emph>dm:node-kind</emph> and <emph>dm:parent</emph>
  also apply to text nodes and may return results other than the empty
  sequence.
  The accessors <emph>dm:name</emph>, <emph>dm:base-uri</emph>,
  <emph>dm:children</emph>, <emph>dm:attributes</emph>,
  <emph>dm:namespaces</emph>, <emph>dm:type</emph> and
  <emph>dm:unique-ID</emph> applied to a text node always return the empty
  sequence.</p>

  <p>The mapping from character information items to text nodes occurs 
  in the <loc href="#infoitem-to-element-node">infoitem-to-element-node</loc> 
  function.  The <emph>infoset-character-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">
function infoset-character-code(<loc href="#CharacterItem">CharacterItem</loc> $ii) returns Code</p>

  <p>The function <emph>infoitem-to-single-character-text-node</emph> takes one character
  information item and maps it to a text node with a string value of 
  length one.</p>

  <p id="infoitem-to-single-character-text-node" role="definition">
define function infoitem-to-single-character-text-node(<loc href="#CharacterItem">CharacterItem</loc> $ii)
       returns <loc href="#TextNode">TextNode</loc>
{
  {-- convert character code to string of length 1 --}
  return <loc href="#TextNode">dm:text-node</loc>(code2string(infoset-character-code($ii)))
}</p>

  <ednote><edtext>JM: need a definition or description of code2string.</edtext></ednote>

  <p>The <emph>collapse-text-nodes</emph> function synthesizes a single text 
  node from multiple text nodes. It calls <emph>infoitem-to-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="collapse-text-nodes" role="definition">
define function collapse-text-nodes(Node* $nodes) returns Node* 
{
  let $newnodes:= infoitem-to-text-nodes($nodes)
  return 
    if (<loc href="#flags">ignore-whitespace</loc>) then 
      <loc href="#sequence-map">sequence-map</loc>(delete-whitespace-node, $newnodes)
    else $newnodes
}

define function infoitem-to-text-nodes(Node* $nodes) returns Node* 
{
  if (<loc href="#xf_empty">xf:empty</loc>($nodes)) then return <loc href="#empty-sequence">empty-sequence</loc>()
  else
    let $head:= <loc href="#op_item-at">op:item-at</loc>($nodes, 1), 
        $tail:= <loc href="#xf_sublist">xf:sublist</loc>($nodes, 2)
    return
      if (dm:node-kind($head) = "text") then
        /* Collapse two consecutive text nodes and apply 
           infoitem-to-text-nodes recursively */
        if (<loc href="#xf_empty">xf:empty</loc>($tail)) then $head
        else if (dm:node-kind(<loc href="#op_item-at">op:item-at</loc>($tail,1)) = "text") then 
          infoitem-to-text-nodes(
            op:concatenate(
              dm:text-node(<loc href="#xf_concat">xf:concat</loc>(dm:string-value($head),
                                     dm:string-value(<loc href="#op_item-at">op:item-at</loc>($tail,1)))), 
              <loc href="#xf_sublist">xf:sublist</loc>($tail, 2)
            )
          )
        else op:concatenate($head,
               op:concatenate(<loc href="#op_item-at">op:item-at</loc>($tail,1),
                              infoitem-to-text-nodes($tail)))
      else op:concatenate($head, infoitem-to-text-nodes($tail))
  }</p>

  <ednote><edtext>JM: need a definition or description of delete-whitespace-node.</edtext></ednote>

<!--  infoset-character-parent     : (<loc href="#CharacterItem">CharacterItem</loc>) -> Sequence&lt;<loc href="#ElementItem">ElementItem</loc>&gt; /* unused */
  infoset-character-whitespace : (<loc href="#CharacterItem">CharacterItem</loc>) -> <loc href="#dt-atomic-value">xs:boolean</loc> /* unused */
-->  
</div2>
</div1>


<div1 id="AtomicValue">
  <head>Atomic Values</head>

  <ednote><edtext>MN:
  Atomic values were previously called simple or simple-typed values. The
  current terminology clarifies that the type of these values is an XML
  Schema atomic type.
  </edtext></ednote>

  <p><termdef id="dt-atomic-value" term="atomic value">A <term>atomic 
  value</term> encapsulates an <emph>XML Schema atomic type</emph>
  and a corresponding value of that type.</termdef></p>

  <p>An XMLSchema atomic type <bibref ref="xmlschema-2"/> may be
  <emph>primitive</emph> or <emph>derived</emph>.
  The primitive atomic types 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>.
  
  A derived atomic type is derived by restriction and has a primitive
  base type and a set of constraining facets.</p> 

  <p>It is noted that the value space of the atomic values is the
  union of the value spaces of the nineteen primitive XML Schema types.
  This value space clearly includes those atomic values whose type is
  primitive, but it also includes those whose type is derived, as
  derivation by restriction always limits the value space.
  </p>
  
  <p>An XMLSchema simple type <bibref ref="xmlschema-2"/> may be also
  <emph>primitive</emph> or <emph>derived</emph> with the method of
  derivation being <emph>restriction</emph>, <emph>list</emph> or
  <emph>union</emph>.
  The atomic types are exactly those types where the derivation method
  is restriction only and not list or union. Values corresponding
  to such types are represented by atomic values.
  XML Schema simple types can be derived by list. Values corresponding
  to such types are represented by a sequence of atomic values
  whose type is the base type.
  XML Schema simple types can be derived by union. Values corresponding
  to such types lose the union type information and store one of
  the individual types.
  </p>

<!--
  <note><p>xs:anySimpleType is not represented in the data model.  See 
  <specref ref="Issue-0036"/>.</p></note>
-->  

  <p>An atomic value can be constructed from its lexical representation.
  The constructor <emph>dm:atomic-value</emph> takes a string
  and a corresponding atomic type. </p>

  <p role="definition" id="ctor_atomic-value">
function dm:atomic-value(<loc href="#dt-atomic-value">xs:string</loc> $value, <loc href="#dt-atomic-value">xs:QName</loc> $type) returns <loc href="#AtomicValue">AtomicValue</loc>
</p>

  <p>This constructor corresponds very closely to the atomic
  value constructors specified in <bibref ref="XFO"/>.
  Each of those constructors takes a string in the lexical space of the 
  given primitive type and returns the corresponding atomic value.
  For example, the constructor 
  <code><loc href="#xf_decimal">xf:decimal</loc>(<loc href="#xf_string">xf:string</loc>)</code>
  constructs an atomic value of type xs:decimal from a string.
  Analogous constructors exist for the other XML Schema primitive types.</p>

  <p>The accessor <emph>dm:type</emph> returns an atomic value's type.
  The accessor <emph>dm:string-value</emph> can be used to recover a
  lexical representation of the atomic value:
  If the atomic value's type is primitive, it returns the
  atomic value's canonical lexical representation for that primitive
  type as specified in XML Schema Part 2 : Datatypes
  <bibref ref="xmlschema-2"/>.
  If the atomic value's type is derived, it returns the
  atomic value's canonical lexical representation for the base type
  (which is a primitive type). See <specref ref="Issue-0072"/>.</p>
    
    <p role="definition">
function dm:type(<loc href="#AtomicValue">AtomicValue</loc> $v)         returns <loc href="#dt-atomic-value">xs:QName</loc>
function dm:string-value(<loc href="#AtomicValue">AtomicValue</loc> $v) returns <loc href="#dt-atomic-value">xs:string</loc></p>

  <note>
    <p>Using the canonical lexical representation for atomic values
     as described above may not always be compatible with XPath 1.0.</p>
  </note>

  <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 may be represented in the data 
  model (see <specref ref="Issue-0032"/>).</p>

</div1>


<div1 id="sequences">
  <head>Sequences</head>

  <p>A <emph>sequence</emph> is an ordered collection of zero or more
  items. An <emph>item</emph> may be a node or an atomic value, i.e.
  a sequence may contain nodes, atomic values, or any mixture of
  nodes and atomic values (see <specref ref="Issue-0035"/>).
  When a node is added to a sequence its identity remains the same.
  Consequently one node may be contained in more than one sequence
  and a sequence may contain duplicate items.
  Unlike conventional lists, sequences are "flat", i.e., sequences may not 
  contain other sequences.</p>

  <p>An important characteristic of the data model is that there is no
  distinction between an item (i.e., a node or an atomic value) and a 
  singleton sequence containing that item, i.e., an item is 
  equivalent to a singleton sequence containing that item and vice 
  versa.</p>
  
  <note>
    <p>Sequences replace node-sets from 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 is provided by functions 
    on node sequences.</p>
  </note>
  
  <note><p>See <specref ref="Issue-0025"/>.</p></note>
  
  <p>A collection of documents is represented in the data model as a 
  sequence of document nodes (see <specref ref="Issue-0023"/>).</p>

  <p>A sequence has no identity.  Equality comparison of sequences is 
  performed only by comparing the items of the sequences.</p>

  <p>The <emph>dm:string-value</emph> of a sequence containing atomic
  values only is obtained by inserting a <code>#x20</code> (space)
  separator between the <emph>dm:string-value</emph>s of the individual
  members of the sequence and concatenating the result.</p>
  
  <p>The <emph>dm:string-value</emph> of a sequence containing any item
  other than an atomic value is the concatenation of the
  <emph>dm:string-value</emph>s of the individual members of the sequence.
  In particular the string value of an empty sequence is an empty string.
  </p>
  
  <p>The constructor <emph>empty-sequence</emph> constructs the empty 
  sequence.  The n-ary <emph>op:concatenate</emph> constructor creates a
  new sequence containing the values in its first argument followed by 
  the concatenated values of its second through final arguments.
  In the function signatures below <emph>Item</emph> refers to a
  nodes or an atomic value.
  Since an item is equivalent to a singleton sequence containing the
  item, <emph>op:concatenate</emph> may be applied to items.</p>
  
  <p role="definition" id="empty-sequence">
function empty-sequence()                  returns <emph>Item</emph>*
function op:concatenate(<emph>Item</emph>*, ..., <emph>Item</emph>*) returns <emph>Item</emph>*</p>  

  <p>A sequence has several accessors. They are defined in <bibref ref="XFO"/>.
  In this document the following four accessors are used.
  The <emph>empty</emph> accessor returns a boolean indicating whether or
  not the specified sequence is empty.
  The <emph>item-at</emph> accessor returns the item in the sequence that
  is located at the specified index.
  The <emph>sublist</emph> accessor returns the contiguous sequence of items
  beginning at the specified position and continuing to the end of the
  sequence. 
  The <emph>count</emph> function returns the number of items in the sequence. 
  </p>

  <p role="definition">
function empty(<emph>Item</emph>*)              returns xs:boolean
function item-at(<emph>Item</emph>*,xs:decimal) returns <emph>Item</emph>
function sublist(<emph>Item</emph>*,xs:decimal) returns <emph>Item</emph>*
function count(<emph>Item</emph>*)              returns xs:unsignedInt</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 (see <specref ref="Issue-0047"/>).  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 (see 
  <specref ref="Issue-0048"/>).</p>
  
</div1>

</body>


<back>
<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 name</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 name</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 name</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">type definition</emph>,
    <emph role="infoset-property">type definition namespace</emph>,
    <emph role="infoset-property">type definition name</emph>,
    <emph role="infoset-property">type definition anonymous</emph>,
    <emph role="infoset-property">member type definition</emph>,
    <emph role="infoset-property">member type definition namespace</emph>,
    <emph role="infoset-property">member type definition name</emph>,
    <emph role="infoset-property">member type definition anonymous</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">validity</emph>, 
    <emph role="infoset-property">type definition</emph>,
    <emph role="infoset-property">type definition namespace</emph>,
    <emph role="infoset-property">type definition name</emph>,
    <emph role="infoset-property">type definition anonymous</emph>,
    <emph role="infoset-property">member type definition</emph>,
    <emph role="infoset-property">member type definition namespace</emph>,
    <emph role="infoset-property">member type definition name</emph>,
    <emph role="infoset-property">member type definition anonymous</emph> and
    <emph role="infoset-property">schema normalized value</emph> properties on
    <em