DTMXPathDocument.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. //
  2. // Mono.Xml.XPath.DTMXPathDocument
  3. //
  4. // Author:
  5. // Atsushi Enomoto ([email protected])
  6. //
  7. // (C) 2003 Atsushi Enomoto
  8. //
  9. using System;
  10. using System.Collections;
  11. using System.Xml;
  12. using System.Xml.XPath;
  13. namespace Mono.Xml.XPath
  14. {
  15. #if OUTSIDE_SYSTEM_XML
  16. public
  17. #else
  18. internal
  19. #endif
  20. class DTMXPathDocument : IXPathNavigable
  21. {
  22. #region ctor.
  23. public DTMXPathDocument (XmlNameTable nameTable,
  24. DTMXPathLinkedNode [] nodes,
  25. DTMXPathAttributeNode [] attributes,
  26. DTMXPathNamespaceNode [] namespaces,
  27. Hashtable idTable)
  28. {
  29. this.nameTable = nameTable;
  30. this.nodes = nodes;
  31. this.attributes = attributes;
  32. this.namespaces = namespaces;
  33. this.idTable = idTable;
  34. }
  35. #endregion
  36. #region Methods
  37. public XPathNavigator CreateNavigator ()
  38. {
  39. if (root == null) {
  40. root = new DTMXPathNavigator (this,
  41. nameTable,
  42. nodes,
  43. attributes,
  44. namespaces,
  45. idTable);
  46. }
  47. return root.Clone ();
  48. }
  49. #endregion
  50. XmlNameTable nameTable;
  51. // Root XPathNavigator.
  52. DTMXPathNavigator root;
  53. #region Immutable tree fields
  54. DTMXPathLinkedNode [] nodes = new DTMXPathLinkedNode [0];
  55. DTMXPathAttributeNode [] attributes = new DTMXPathAttributeNode [0];
  56. DTMXPathNamespaceNode [] namespaces = new DTMXPathNamespaceNode [0];
  57. // idTable [string value] -> int nodeId
  58. readonly Hashtable idTable;
  59. #endregion
  60. }
  61. }