[11] [DFN[XPath 1.0データモデル]]は、 [[XPath 1.0]] が採用している [[XML文書]]の内部表現形式です。
[[XPath 1.0]] の他、 [[XPath 1.0]] を採用する [[XSLT 1.0]] などの言語で使われています。

* 節点木データモデル

** 元々の XPath 1.0

@@

** DOM XPath のデータモデル

[HISTORY[
[15] [[DOM3 XPath]] は [[DOM]] を [[XPath 1.0データモデル]]に合わせるため[[名前空間節点]]を
[[DOM]] に追加するなどしていますが、実装には無視されていました。
]HISTORY]

[3] [[Chrome]]、[[Firefox]] とも [CODE(DOMi)@en[[[DocumentType]]]] [[節点]]が存在します。
[CODE(XPathFunction)@en[[[string()]]]] や [CODE(XPathFunction)@en[[[name()]]]]
は[[空文字列]]になります。 [TIME[2013-09-28T13:03:13.400Z]]

[7] [[根節点]]の扱いについては、[[根節点]]の項を参照してください。

** XSLT のデータモデル

[8] [[根節点]]の拡張については、[[根節点]]の項を参照してください。

[16] 
[CODE[template]] [[要素]]の扱いは、
[[DOM XPath]] と [[XSLT 1.0]] とで異なっています。
[SEE[ [CODE[template]] ]]

[4] [CITE@EN[XSL Transformations (XSLT) Version 1.1]] ([TIME[2001-08-24 14:35:28 +09:00]] 版) <http://www.w3.org/TR/xslt11/#N11359>

[FIG(quote)[
[FIGCAPTION[
[13] [CITE@en[RFC 7950 - The YANG 1.1 Data Modeling Language]]
([TIME[2016-09-15 03:32:37 +09:00]])
<https://tools.ietf.org/html/rfc7950#section-6.4>
]FIGCAPTION]

> The data model used in the XPath expressions is the same as that used
in XPath 1.0 '''['''XPATH''']''', with the same extension for root node children
as used by XSLT 1.0 (see Section 3.1 in '''['''XSLT''']''').  Specifically, it
means that the root node may have any number of element nodes as its
children.

]FIG]


** XPointer

[9] [[根節点]]の拡張については、[[根節点]]の項を参照してください。

** XForms

[5] [CITE@EN[XForms 1.1]] ([TIME[2010-08-12 22:45:33 +09:00]] 版) <http://www.w3.org/TR/xforms/#expr-instance>

** X#

[2] [CITE[X Sharp/Data Types]] ([TIME[2009-01-22 20:51:58 +09:00]] 版) <http://wiki.codeglide.com/X_Sharp/Data_Types#Node>

>The X# Document Object Model implementation supports all six XML node types:
- Element
- Attribute
- Text (Unicode and Binary text nodes are permitted)
- Namespace
- Comment
- Processing Instruction 

「Binary text nodes」

* データ型

[14] [[XPath 1.0]] には次の[[データ型]]があります。

[FIG(short list)[
- [[節点集合]]
- [[文字列][XPath 1.0文字列]]
- [[数値]]
- [[boolean]]
]FIG]

* 歴史

[12] [[XPath 1.0データモデル]]は、 [[XML情報集合]]の設計上のベースとなった[[データモデル]]の1つです。

[10] [[XPath 2.0]]/[[XSLT 2.0]] 以降は [[XDM]] を使っています。 [[XDM]]
は [[XPath 1.0のデータモデル]]をベースにしているようですが、大きく変更されています。

* 実装

[6] [CITE@en[760029 – XPath expression `//node()` shouldn’t match the DOCTYPE node]]
( ([TIME[2013-11-01 00:08:53 +09:00]] 版))
<https://bugzilla.mozilla.org/show_bug.cgi?id=760029>

* メモ

[1] 
[PRE[
DataModel:
  @FullName:
    @@lang:en
    @@@:
      XPath 1.0 Data Model
  
  @ImplNote:
    @@lang:en
    @@@:
      A namespace URI of an expanded-name should be resolved 
      to an absolute URI reference.
      \
      {P:: Two expanded-names are equal if:
         \
         - they have the same local part and
         \
         - both have a null namespace URI or  
           both have non-null namespace URIs that are equal.
         \
      }
  @ImplNote:
    @@lang:en
    @@@:
      {LI:: <DFN:document order>:: The order in which the first 
        character of the XML representation of each node 
        occurs in the document after expansion of general entities. 
        \
        - The attribute nodes and namespace nodes occur before 
          the children of the element.
        \
        - The namespace nodes occur before the attribute nodes.
        \
        - The relative order of namespace nodes and the attribute nodes 
          is implementation-dependent.
        \
      }
      \
      - <DFN:reverse document order>:: The reverse of document order.
  @ImplNote:
    @@lang:en
    @@@:
      - <DFN:descendants>:: The children of the node and 
                            the descendants of the children.
  
  @InfoItem:
    @@FullName:
      @@@lang:en
      @@@@: root node
    @@Description:
      @@@lang:en
      @@@@:
        The root of the tree.  A root node does not occur except 
        as the root of the tree.
    @@Prop:
      @@@Description:
        @@@@lang:en
        @@@@@: An ordered list of child nodes.
    @@Prop:
      @@@Name:string-value
      @@@Description:
        @@@@lang:en
        @@@@@:
          The concatenation of the <CODE:string-value>s of all 
          text node descendants of the root node in document order.
  
  @InfoItem:
    @@FullName:
      @@@lang:en
      @@@@:element node
    @@InfoProp:
      @@@Name:expanded-name
      @@@Description:
        @@@@lang:en
        @@@@@:
          Computed by expanding the <CODE:QName> of the element 
          specified in the tag.  The namespace URI will be null 
          if the <CODE:QName> has no prefix and there is no 
          applicable default namespace.
    @@InfoProp:
      @@@Name:children
      @@@Description:
        @@@@lang:en
        @@@@@:
          An ordered list of child nodes.  Note that entity references 
          are expanded and character references are resolved.
    @@InfoProp:
      @@@Name:string-value
      @@@Description:
        @@@@lang:en
        @@@@@:
          The concatenation of the <CODE:string-value>s of all 
          text node descendants in document order.
    @@InfoProp:
      @@@FullName:
        @@@@lang:en
        @@@@@: unique identifier
      @@@Description:
        @@@@lang:en
        @@@@@:
          The DTD-determined ID value.  Note that if an XML processor 
          reports two elements in a document as having the same unique 
          ID, the second element in document order must be treated 
          as not having a unique ID.
    @@InfoProp:
      @@FullName:
        @@@lang:en
        @@@@:parent

  @InfoItem:
    @@FullName:
      @@@lang:en
      @@@@:attribute node
    @@InfoProp:
      @@@FullName:
        @@@@lang:en
        @@@@@:parent
      @@@Description:
        @@@@lang:en
        @@@@@:
          The owner element.  Note that an attribute node is not 
          a child of the parent element.
    @@ImplNote:
      @@@lang:en
      @@@@:
        Default attributes are treated the same as specified ones.
    @@InfoProp:
      @@@FullName:
        @@@@lang:en
        @@@@@:expanded-name
      @@@Description:
        @@@@lang:en
        @@@@@:
          Computed by expanding the <CODE:QName> specified in the tag. 
          The namespace URI will be null if the <CODE:QName> does 
          not have a prefix.
    @@InfoProp:
      @@@FullName:
        @@@@lang:en
        @@@@@:string-value
      @@@Description:
        @@@@lang:en
        @@@@@:
          The normalized value.  Note that is might be a zero-length string.

  @InfoItem:
    @@FullName:
      @@@lang:en
      @@@@:namespace node
    @@Description:
      @@@lang:en
      @@@@:
        In-scope namespace declarations, including implied 
        <XML:xml> namespace declaration.
        \
        {NOTE:: An <XML:xmlns=""> attribute undeclares the 
                default namespace; that element and its 
                descendants have no default namespace node.
        \
        }
    @@InfoProp:
      @@@FullName:
        @@@@lang:en
        @@@@@:parent
      @@@Description:
        @@@@lang:en
        @@@@@:
          The owner element.  Note that a namespace node is not a 
          child of the parent element.
    @@InfoProp:
      @@@FullName:
        @@@@lang:en
        @@@@@:expanded-name
      @@@Description:
        @@@@lang:en
        @@@@@:
          The local part is the namespace prefix or empty if 
          the namespace node is for the default namespace.  
          The namespace URI is always null.
    @@InfoProp:
      @@@FullName:
        @@@@lang:en
        @@@@@:string-value
      @@@Description:
        @@@@lang:en
        @@@@@:
          The namespace URI bound to the prefix.  If it is a relative 
          URI, it must be resolved.

  @InfoItem:
    @@FullName:
       @@@lang:en
       @@@@:processing instruction node
    @@InfoProp:
      @@@FullName:
        @@@@lang:en
        @@@@@:parent
    @@InfoProp:
      @@@FullName:
        @@@@lang:en
        @@@@@:expanded-name
      @@@Description:
        @@@@lang:en
        @@@@@:
          The local part is the target.  The namespace URI is null.
    @@InfoProp:
      @@@FullName:
        @@@@lang:en
        @@@@@:string-value
      @@@Description:
        @@@@lang:en
        @@@@@:
          The target data (following the target name and any white space).

  @InfoItem:
    @@FullName:
      @@@lang:en
      @@@@:comment node
    @@InfoProp:
      @@@FullName:
        @@@@lang:en
        @@@@@:parent
    @@InfoProp:
      @@@FullName:
        @@@@lang:en
        @@@@@:string-value
      @@@Description:
        @@@@lang:en
        @@@@@:
          The content of the comment.
  @InfoItem:
    @@FullName:
      @@@lang:en
      @@@@:text node
    @@InfoProp:
      @@@FullName:
        @@@@lang:en
        @@@@@:parent
    @@InfoProp:
      @@@FullName:
        @@@@lang:en
        @@@@@:string-value
      @@@Description:
        @@@@lang:en
        @@@@@:
          The character data, always has at least one character.
]PRE]

