XmlDocument.cs 19 KB

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