2004-02-16 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mcs / class / System.XML / Mono.Xml.XPath / DTMXPathDocument.cs
1 //
2 // Mono.Xml.XPath.DTMXPathDocument
3 //
4 // Author:
5 //      Atsushi Enomoto (ginga@kit.hi-ho.ne.jp)
6 //
7 // (C) 2003 Atsushi Enomoto
8 //
9 using System;
10 using System.Collections;
11 using System.Xml;
12 using System.Xml.XPath;
13
14 namespace Mono.Xml.XPath
15 {
16 #if OUTSIDE_SYSTEM_XML
17         public
18 #else
19         internal
20 #endif
21                 class DTMXPathDocument : IXPathNavigable
22         {
23
24 #region ctor.
25
26                 public DTMXPathDocument (XmlNameTable nameTable,
27                         DTMXPathLinkedNode [] nodes,
28                         DTMXPathAttributeNode [] attributes,
29                         DTMXPathNamespaceNode [] namespaces,
30                         Hashtable idTable)
31                 {
32                         this.nameTable = nameTable;
33                         this.nodes = nodes;
34                         this.attributes = attributes;
35                         this.namespaces = namespaces;
36                         this.idTable = idTable;
37                 }
38
39 #endregion
40
41
42 #region Methods
43                 public XPathNavigator CreateNavigator ()
44                 {
45                         if (root == null) {
46                                 root = new DTMXPathNavigator (this,
47                                         nameTable,
48                                         nodes,
49                                         attributes,
50                                         namespaces,
51                                         idTable);
52                         }
53                         return root.Clone ();
54                 }
55
56 #endregion
57
58                 XmlNameTable nameTable;
59
60                 // Root XPathNavigator.
61                 DTMXPathNavigator root;
62
63 #region Immutable tree fields
64
65                 DTMXPathLinkedNode [] nodes = new DTMXPathLinkedNode [0];
66                 DTMXPathAttributeNode [] attributes = new DTMXPathAttributeNode [0];
67                 DTMXPathNamespaceNode [] namespaces = new DTMXPathNamespaceNode [0];
68
69                 // idTable [string value] -> int nodeId
70                 readonly Hashtable idTable;
71
72 #endregion
73
74         }
75 }
76