XmlDocument.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  1. //
  2. // System.Xml.XmlDocument
  3. //
  4. // Authors:
  5. // Daniel Weber ([email protected])
  6. // Kral Ferch <[email protected]>
  7. // Jason Diamond <[email protected]>
  8. // Miguel de Icaza ([email protected])
  9. // Duncan Mak ([email protected])
  10. //
  11. // (C) 2001 Daniel Weber
  12. // (C) 2002 Kral Ferch, Jason Diamond, Miguel de Icaza, Duncan Mak
  13. //
  14. using System;
  15. using System.IO;
  16. using System.Text;
  17. using System.Xml.XPath;
  18. using System.Diagnostics;
  19. using System.Collections;
  20. namespace System.Xml
  21. {
  22. public class XmlDocument : XmlNode
  23. {
  24. #region Fields
  25. XmlLinkedNode lastLinkedChild;
  26. XmlNameTable nameTable;
  27. string baseURI = String.Empty;
  28. XmlImplementation implementation;
  29. bool preserveWhitespace = true; // Its true initial value is false.
  30. #endregion
  31. #region Constructors
  32. public XmlDocument () : base (null)
  33. {
  34. implementation = new XmlImplementation();
  35. nameTable = implementation.internalNameTable;
  36. AddDefaultNameTableKeys();
  37. }
  38. protected internal XmlDocument (XmlImplementation imp) : base (null)
  39. {
  40. implementation = imp;
  41. nameTable = imp.internalNameTable;
  42. AddDefaultNameTableKeys();
  43. }
  44. public XmlDocument (XmlNameTable nt) : base (null)
  45. {
  46. implementation = new XmlImplementation();
  47. implementation.internalNameTable = nt;
  48. nameTable = nt;
  49. AddDefaultNameTableKeys();
  50. }
  51. #endregion
  52. #region Events
  53. public event XmlNodeChangedEventHandler NodeChanged;
  54. public event XmlNodeChangedEventHandler NodeChanging;
  55. public event XmlNodeChangedEventHandler NodeInserted;
  56. public event XmlNodeChangedEventHandler NodeInserting;
  57. public event XmlNodeChangedEventHandler NodeRemoved;
  58. public event XmlNodeChangedEventHandler NodeRemoving;
  59. #endregion
  60. #region Properties
  61. public override string BaseURI {
  62. get {
  63. return baseURI;
  64. }
  65. }
  66. public XmlElement DocumentElement {
  67. get {
  68. XmlNode node = FirstChild;
  69. while (node != null) {
  70. if (node is XmlElement)
  71. break;
  72. node = node.NextSibling;
  73. }
  74. return node != null ? node as XmlElement : null;
  75. }
  76. }
  77. [MonoTODO("It doesn't have internal subset object model.")]
  78. public virtual XmlDocumentType DocumentType {
  79. get {
  80. foreach(XmlNode n in this.ChildNodes) {
  81. if(n.NodeType == XmlNodeType.DocumentType)
  82. return (XmlDocumentType)n;
  83. }
  84. return null;
  85. }
  86. }
  87. public XmlImplementation Implementation {
  88. get { return implementation; }
  89. }
  90. public override string InnerXml {
  91. get {
  92. return base.InnerXml;
  93. }
  94. set { // reason for overriding
  95. this.LoadXml(value);
  96. }
  97. }
  98. public override bool IsReadOnly {
  99. get { return false; }
  100. }
  101. internal override XmlLinkedNode LastLinkedChild {
  102. get {
  103. return lastLinkedChild;
  104. }
  105. set {
  106. lastLinkedChild = value;
  107. }
  108. }
  109. public override string LocalName {
  110. get { return "#document"; }
  111. }
  112. public override string Name {
  113. get { return "#document"; }
  114. }
  115. public XmlNameTable NameTable {
  116. get { return nameTable; }
  117. }
  118. public override XmlNodeType NodeType {
  119. get { return XmlNodeType.Document; }
  120. }
  121. internal override XPathNodeType XPathNodeType {
  122. get {
  123. return XPathNodeType.Root;
  124. }
  125. }
  126. public override XmlDocument OwnerDocument {
  127. get { return null; }
  128. }
  129. [MonoTODO("wait for getting 'xml:space' status for each node")]
  130. public bool PreserveWhitespace {
  131. get { return preserveWhitespace; }
  132. set { preserveWhitespace = value; }
  133. }
  134. [MonoTODO]
  135. public virtual XmlResolver XmlResolver {
  136. set { throw new NotImplementedException(); }
  137. }
  138. #endregion
  139. #region Methods
  140. [MonoTODO]
  141. public override XmlNode CloneNode (bool deep)
  142. {
  143. throw new NotImplementedException ();
  144. }
  145. public XmlAttribute CreateAttribute (string name)
  146. {
  147. return CreateAttribute (name, String.Empty);
  148. }
  149. public XmlAttribute CreateAttribute (string qualifiedName, string namespaceURI)
  150. {
  151. string prefix;
  152. string localName;
  153. ParseName (qualifiedName, out prefix, out localName);
  154. return CreateAttribute (prefix, localName, namespaceURI);
  155. }
  156. public virtual XmlAttribute CreateAttribute (string prefix, string localName, string namespaceURI)
  157. {
  158. if ((localName == null) || (localName == String.Empty))
  159. throw new ArgumentException ("The attribute local name cannot be empty.");
  160. return new XmlAttribute (prefix, localName, namespaceURI, this);
  161. }
  162. public virtual XmlCDataSection CreateCDataSection (string data)
  163. {
  164. return new XmlCDataSection (data, this);
  165. }
  166. public virtual XmlComment CreateComment (string data)
  167. {
  168. return new XmlComment(data, this);
  169. }
  170. [MonoTODO]
  171. protected internal virtual XmlAttribute CreateDefaultAttribute (string prefix, string localName, string namespaceURI)
  172. {
  173. throw new NotImplementedException ();
  174. }
  175. public virtual XmlDocumentFragment CreateDocumentFragment ()
  176. {
  177. return new XmlDocumentFragment(this);
  178. }
  179. public virtual XmlDocumentType CreateDocumentType (string name, string publicId,
  180. string systemId, string internalSubset)
  181. {
  182. return new XmlDocumentType (name, publicId, systemId, internalSubset, this);
  183. }
  184. public XmlElement CreateElement (string name)
  185. {
  186. return CreateElement (name, String.Empty);
  187. }
  188. public XmlElement CreateElement (
  189. string qualifiedName,
  190. string namespaceURI)
  191. {
  192. string prefix;
  193. string localName;
  194. ParseName (qualifiedName, out prefix, out localName);
  195. return CreateElement (prefix, localName, namespaceURI);
  196. }
  197. public virtual XmlElement CreateElement (
  198. string prefix,
  199. string localName,
  200. string namespaceURI)
  201. {
  202. if ((localName == null) || (localName == String.Empty))
  203. throw new ArgumentException ("The local name for elements or attributes cannot be null or an empty string.");
  204. return new XmlElement (prefix != null ? prefix : String.Empty, localName, namespaceURI != null ? namespaceURI : String.Empty, this);
  205. }
  206. [MonoTODO]
  207. public virtual XmlEntityReference CreateEntityReference (string name)
  208. {
  209. throw new NotImplementedException ();
  210. }
  211. [MonoTODO]
  212. protected internal virtual XPathNavigator CreateNavigator (XmlNode node)
  213. {
  214. throw new NotImplementedException ();
  215. }
  216. public virtual XmlNode CreateNode (
  217. string nodeTypeString,
  218. string name,
  219. string namespaceURI)
  220. {
  221. return CreateNode (GetNodeTypeFromString (nodeTypeString), name, namespaceURI);
  222. }
  223. public virtual XmlNode CreateNode (
  224. XmlNodeType type,
  225. string name,
  226. string namespaceURI)
  227. {
  228. string prefix = null;
  229. string localName = name;
  230. if ((type == XmlNodeType.Attribute) || (type == XmlNodeType.Element) || (type == XmlNodeType.EntityReference))
  231. ParseName (name, out prefix, out localName);
  232. return CreateNode (type, prefix, localName, namespaceURI);
  233. }
  234. public virtual XmlNode CreateNode (
  235. XmlNodeType type,
  236. string prefix,
  237. string name,
  238. string namespaceURI)
  239. {
  240. switch (type) {
  241. case XmlNodeType.Attribute: return CreateAttribute (prefix, name, namespaceURI);
  242. case XmlNodeType.CDATA: return CreateCDataSection (null);
  243. case XmlNodeType.Comment: return CreateComment (null);
  244. case XmlNodeType.Document: return new XmlDocument (); // TODO - test to see which constructor to use, i.e. use existing NameTable or not.
  245. case XmlNodeType.DocumentFragment: return CreateDocumentFragment ();
  246. case XmlNodeType.DocumentType: return CreateDocumentType (null, null, null, null);
  247. case XmlNodeType.Element: return CreateElement (prefix, name, namespaceURI);
  248. case XmlNodeType.EntityReference: return CreateEntityReference (null);
  249. case XmlNodeType.ProcessingInstruction: return CreateProcessingInstruction (null, null);
  250. case XmlNodeType.SignificantWhitespace: return CreateSignificantWhitespace (String.Empty);
  251. case XmlNodeType.Text: return CreateTextNode (null);
  252. case XmlNodeType.Whitespace: return CreateWhitespace (String.Empty);
  253. case XmlNodeType.XmlDeclaration: return CreateXmlDeclaration ("1.0", null, null);
  254. default: throw new ArgumentOutOfRangeException(String.Format("{0}\nParameter name: {1}",
  255. "Specified argument was out of the range of valid values", type.ToString ()));
  256. }
  257. }
  258. public virtual XmlProcessingInstruction CreateProcessingInstruction (
  259. string target,
  260. string data)
  261. {
  262. return new XmlProcessingInstruction (target, data, this);
  263. }
  264. public virtual XmlSignificantWhitespace CreateSignificantWhitespace (string text)
  265. {
  266. foreach (char c in text)
  267. if ((c != ' ') && (c != '\r') && (c != '\n') && (c != '\t'))
  268. throw new ArgumentException ("Invalid whitespace characters.");
  269. return new XmlSignificantWhitespace (text, this);
  270. }
  271. public virtual XmlText CreateTextNode (string text)
  272. {
  273. return new XmlText (text, this);
  274. }
  275. public virtual XmlWhitespace CreateWhitespace (string text)
  276. {
  277. foreach (char c in text)
  278. if ((c != ' ') && (c != '\r') && (c != '\n') && (c != '\t'))
  279. throw new ArgumentException ("Invalid whitespace characters.");
  280. return new XmlWhitespace (text, this);
  281. }
  282. public virtual XmlDeclaration CreateXmlDeclaration (string version, string encoding,
  283. string standalone)
  284. {
  285. if (version != "1.0")
  286. throw new ArgumentException ("version string is not correct.");
  287. if ((standalone != null && standalone != String.Empty) && !((standalone == "yes") || (standalone == "no")))
  288. throw new ArgumentException ("standalone string is not correct.");
  289. return new XmlDeclaration (version, encoding, standalone, this);
  290. }
  291. [MonoTODO]
  292. public virtual XmlElement GetElementById (string elementId)
  293. {
  294. throw new NotImplementedException ();
  295. }
  296. public virtual XmlNodeList GetElementsByTagName (string name)
  297. {
  298. ArrayList nodeArrayList = new ArrayList ();
  299. this.searchNodesRecursively (this, name, nodeArrayList);
  300. return new XmlNodeArrayList (nodeArrayList);
  301. }
  302. private void searchNodesRecursively (XmlNode argNode, string argName,
  303. ArrayList argArrayList)
  304. {
  305. XmlNodeList xmlNodeList = argNode.ChildNodes;
  306. foreach (XmlNode node in xmlNodeList){
  307. if (node.Name.Equals (argName))
  308. argArrayList.Add (node);
  309. else
  310. this.searchNodesRecursively (node, argName, argArrayList);
  311. }
  312. }
  313. private void searchNodesRecursively (XmlNode argNode, string argName, string argNamespaceURI,
  314. ArrayList argArrayList)
  315. {
  316. XmlNodeList xmlNodeList = argNode.ChildNodes;
  317. foreach (XmlNode node in xmlNodeList){
  318. if (node.LocalName.Equals (argName) && node.NamespaceURI.Equals (argNamespaceURI))
  319. argArrayList.Add (node);
  320. else
  321. this.searchNodesRecursively (node, argName, argNamespaceURI, argArrayList);
  322. }
  323. }
  324. public virtual XmlNodeList GetElementsByTagName (string localName, string namespaceURI)
  325. {
  326. ArrayList nodeArrayList = new ArrayList ();
  327. this.searchNodesRecursively (this, localName, namespaceURI, nodeArrayList);
  328. return new XmlNodeArrayList (nodeArrayList);
  329. }
  330. private XmlNodeType GetNodeTypeFromString (string nodeTypeString)
  331. {
  332. switch (nodeTypeString) {
  333. case "attribute": return XmlNodeType.Attribute;
  334. case "cdatasection": return XmlNodeType.CDATA;
  335. case "comment": return XmlNodeType.Comment;
  336. case "document": return XmlNodeType.Document;
  337. case "documentfragment": return XmlNodeType.DocumentFragment;
  338. case "documenttype": return XmlNodeType.DocumentType;
  339. case "element": return XmlNodeType.Element;
  340. case "entityreference": return XmlNodeType.EntityReference;
  341. case "processinginstruction": return XmlNodeType.ProcessingInstruction;
  342. case "significantwhitespace": return XmlNodeType.SignificantWhitespace;
  343. case "text": return XmlNodeType.Text;
  344. case "whitespace": return XmlNodeType.Whitespace;
  345. default:
  346. throw new ArgumentException(String.Format("The string doesn't represent any node type : {0}.", nodeTypeString));
  347. }
  348. }
  349. [MonoTODO("default attributes (of imported doc); EntityReferences; Entity; Notation")]
  350. public virtual XmlNode ImportNode (XmlNode node, bool deep)
  351. {
  352. switch(node.NodeType)
  353. {
  354. case XmlNodeType.Attribute:
  355. {
  356. XmlAttribute src_att = node as XmlAttribute;
  357. XmlAttribute dst_att = this.CreateAttribute(src_att.Prefix, src_att.LocalName, src_att.NamespaceURI);
  358. dst_att.Value = src_att.Value; // always explicitly specified (whether source is specified or not)
  359. return dst_att;
  360. }
  361. case XmlNodeType.CDATA:
  362. return this.CreateCDataSection(node.Value);
  363. case XmlNodeType.Comment:
  364. return this.CreateComment(node.Value);
  365. case XmlNodeType.Document:
  366. throw new XmlException("Document cannot be imported.");
  367. case XmlNodeType.DocumentFragment:
  368. {
  369. XmlDocumentFragment df = this.CreateDocumentFragment();
  370. if(deep)
  371. {
  372. foreach(XmlNode n in node.ChildNodes)
  373. {
  374. df.AppendChild(this.ImportNode(n, deep));
  375. }
  376. }
  377. return df;
  378. }
  379. case XmlNodeType.DocumentType:
  380. throw new XmlException("DocumentType cannot be imported.");
  381. case XmlNodeType.Element:
  382. {
  383. XmlElement src = (XmlElement)node;
  384. XmlElement dst = this.CreateElement(src.Prefix, src.LocalName, src.NamespaceURI);
  385. foreach(XmlAttribute attr in src.Attributes)
  386. {
  387. if(attr.Specified) // copies only specified attributes
  388. dst.SetAttributeNode((XmlAttribute)this.ImportNode(attr, deep));
  389. if(DocumentType != null)
  390. {
  391. // TODO: create default attribute values
  392. }
  393. }
  394. if(deep)
  395. {
  396. foreach(XmlNode n in src.ChildNodes)
  397. dst.AppendChild(this.ImportNode(n, deep));
  398. }
  399. return dst;
  400. }
  401. case XmlNodeType.EndElement:
  402. throw new XmlException ("Illegal ImportNode call for NodeType.EndElement");
  403. case XmlNodeType.EndEntity:
  404. throw new XmlException ("Illegal ImportNode call for NodeType.EndEntity");
  405. case XmlNodeType.Entity:
  406. throw new NotImplementedException (); // TODO
  407. // [2002.10.14] CreateEntityReference not implemented.
  408. case XmlNodeType.EntityReference:
  409. throw new NotImplementedException("ImportNode of EntityReference not implemented mainly because CreateEntityReference was implemented in the meantime.");
  410. // return this.CreateEntityReference(node.Name);
  411. case XmlNodeType.None:
  412. throw new XmlException ("Illegal ImportNode call for NodeType.None");
  413. case XmlNodeType.Notation:
  414. throw new NotImplementedException (); // TODO
  415. case XmlNodeType.ProcessingInstruction:
  416. XmlProcessingInstruction pi = node as XmlProcessingInstruction;
  417. return this.CreateProcessingInstruction(pi.Target, pi.Data);
  418. case XmlNodeType.SignificantWhitespace:
  419. return this.CreateSignificantWhitespace(node.Value);
  420. case XmlNodeType.Text:
  421. return this.CreateTextNode(node.Value);
  422. case XmlNodeType.Whitespace:
  423. return this.CreateWhitespace(node.Value);
  424. case XmlNodeType.XmlDeclaration:
  425. XmlDeclaration srcDecl = node as XmlDeclaration;
  426. return this.CreateXmlDeclaration(srcDecl.Version, srcDecl.Encoding, srcDecl.Standalone);
  427. default:
  428. throw new NotImplementedException ();
  429. }
  430. }
  431. public virtual void Load (Stream inStream)
  432. {
  433. XmlReader xmlReader = new XmlTextReader (inStream);
  434. Load (xmlReader);
  435. }
  436. public virtual void Load (string filename)
  437. {
  438. baseURI = filename;
  439. XmlReader xmlReader = new XmlTextReader (new StreamReader (filename));
  440. Load (xmlReader);
  441. }
  442. public virtual void Load (TextReader txtReader)
  443. {
  444. Load (new XmlTextReader (txtReader));
  445. }
  446. public virtual void Load (XmlReader xmlReader)
  447. {
  448. // Reset our document
  449. // For now this just means removing all our children but later this
  450. // may turn out o need to call a private method that resets other things
  451. // like properties we have, etc.
  452. RemoveAll ();
  453. XmlNode currentNode = this;
  454. // This method of XmlNode is previously written here.
  455. // Then I(ginga) moved them to use this logic with XmlElement.
  456. this.ConstructDOM(xmlReader, currentNode);
  457. }
  458. public virtual void LoadXml (string xml)
  459. {
  460. XmlReader xmlReader = new XmlTextReader (new StringReader (xml));
  461. Load (xmlReader);
  462. }
  463. internal void onNodeChanged (XmlNode node, XmlNode Parent)
  464. {
  465. if (NodeChanged != null)
  466. NodeChanged (node, new XmlNodeChangedEventArgs
  467. (XmlNodeChangedAction.Change,
  468. node, Parent, Parent));
  469. }
  470. internal void onNodeChanging(XmlNode node, XmlNode Parent)
  471. {
  472. if (NodeChanging != null)
  473. NodeChanging (node, new XmlNodeChangedEventArgs
  474. (XmlNodeChangedAction.Change,
  475. node, Parent, Parent));
  476. }
  477. internal void onNodeInserted (XmlNode node, XmlNode newParent)
  478. {
  479. if (NodeInserted != null)
  480. NodeInserted (node, new XmlNodeChangedEventArgs
  481. (XmlNodeChangedAction.Insert,
  482. node, null, newParent));
  483. }
  484. internal void onNodeInserting (XmlNode node, XmlNode newParent)
  485. {
  486. if (NodeInserting != null)
  487. NodeInserting (node, new XmlNodeChangedEventArgs
  488. (XmlNodeChangedAction.Insert,
  489. node, null, newParent));
  490. }
  491. internal void onNodeRemoved (XmlNode node, XmlNode oldParent)
  492. {
  493. if (NodeRemoved != null)
  494. NodeRemoved (node, new XmlNodeChangedEventArgs
  495. (XmlNodeChangedAction.Remove,
  496. node, oldParent, null));
  497. }
  498. internal void onNodeRemoving (XmlNode node, XmlNode oldParent)
  499. {
  500. if (NodeRemoving != null)
  501. NodeRemoving (node, new XmlNodeChangedEventArgs
  502. (XmlNodeChangedAction.Remove,
  503. node, oldParent, null));
  504. }
  505. private void ParseName (string name, out string prefix, out string localName)
  506. {
  507. int indexOfColon = name.IndexOf (':');
  508. if (indexOfColon != -1) {
  509. prefix = name.Substring (0, indexOfColon);
  510. localName = name.Substring (indexOfColon + 1);
  511. } else {
  512. prefix = "";
  513. localName = name;
  514. }
  515. }
  516. [MonoTODO]
  517. public virtual XmlNode ReadNode(XmlReader reader)
  518. {
  519. throw new NotImplementedException ();
  520. }
  521. [MonoTODO ("Verify what encoding is used by default; Should use PreserveWhiteSpace")]
  522. public virtual void Save(Stream outStream)
  523. {
  524. // To implementor: utf-8 is OK, at least for (ginga's) Japanese environment.
  525. XmlTextWriter xmlWriter = new XmlTextWriter (outStream, Encoding.UTF8);
  526. WriteContentTo (xmlWriter);
  527. xmlWriter.Close ();
  528. }
  529. [MonoTODO ("Verify what encoding is used by default; Should use PreseveWhiteSpace")]
  530. public virtual void Save (string filename)
  531. {
  532. // To implementor: utf-8 is OK, at least for (ginga's) Japanese environment.
  533. XmlTextWriter xmlWriter = new XmlTextWriter (filename, Encoding.UTF8);
  534. WriteContentTo (xmlWriter);
  535. xmlWriter.Close ();
  536. }
  537. [MonoTODO]
  538. public virtual void Save (TextWriter writer)
  539. {
  540. XmlTextWriter xmlWriter = new XmlTextWriter (writer);
  541. WriteContentTo (xmlWriter);
  542. xmlWriter.Flush ();
  543. }
  544. [MonoTODO ("Should preserve white space if PreserveWhisspace is set")]
  545. public virtual void Save (XmlWriter xmlWriter)
  546. {
  547. //
  548. // This should preserve white space if PreserveWhiteSpace is true
  549. //
  550. WriteContentTo (xmlWriter);
  551. xmlWriter.Flush ();
  552. }
  553. public override void WriteContentTo (XmlWriter w)
  554. {
  555. foreach(XmlNode childNode in ChildNodes)
  556. childNode.WriteTo(w);
  557. }
  558. public override void WriteTo (XmlWriter w)
  559. {
  560. WriteContentTo(w);
  561. }
  562. private void AddDefaultNameTableKeys()
  563. {
  564. // The following keys are default of MS .NET Framework
  565. nameTable.Add("#text");
  566. nameTable.Add("xml");
  567. nameTable.Add("xmlns");
  568. nameTable.Add("#entity");
  569. nameTable.Add("#document-fragment");
  570. nameTable.Add("#comment");
  571. nameTable.Add("space");
  572. nameTable.Add("id");
  573. nameTable.Add("#whitespace");
  574. nameTable.Add("http://www.w3.org/2000/xmlns/");
  575. nameTable.Add("#cdata-section");
  576. nameTable.Add("lang");
  577. nameTable.Add("#document");
  578. nameTable.Add("#significant-whitespace");
  579. }
  580. #endregion
  581. }
  582. }