2004-01-26 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
17         public class DTMXPathDocument : IXPathNavigable
18         {
19
20 #region ctor.
21
22                 public DTMXPathDocument (XmlNameTable nameTable,
23                         DTMXPathLinkedNode [] nodes,
24                         DTMXPathAttributeNode [] attributes,
25                         DTMXPathNamespaceNode [] namespaces,
26                         Hashtable idTable)
27                 {
28                         this.nameTable = nameTable;
29                         this.nodes = nodes;
30                         this.attributes = attributes;
31                         this.namespaces = namespaces;
32                         this.idTable = idTable;
33                 }
34
35 #endregion
36
37
38 #region Methods
39                 public XPathNavigator CreateNavigator ()
40                 {
41                         if (root == null) {
42                                 root = new DTMXPathNavigator (this,
43                                         nameTable,
44                                         nodes,
45                                         attributes,
46                                         namespaces,
47                                         idTable);
48                         }
49                         return root.Clone ();
50                 }
51
52 #endregion
53
54                 XmlNameTable nameTable;
55
56                 // Root XPathNavigator.
57                 DTMXPathNavigator root;
58
59 #region Immutable tree fields
60
61                 DTMXPathLinkedNode [] nodes = new DTMXPathLinkedNode [0];
62                 DTMXPathAttributeNode [] attributes = new DTMXPathAttributeNode [0];
63                 DTMXPathNamespaceNode [] namespaces = new DTMXPathNamespaceNode [0];
64
65                 // idTable [string value] -> int nodeId
66                 readonly Hashtable idTable;
67
68 #endregion
69
70         }
71 }
72