2 // System.Xml.XmlDocument
5 // Daniel Weber (daniel-weber@austin.rr.com)
6 // Kral Ferch <kral_ferch@hotmail.com>
7 // Jason Diamond <jason@injektilo.org>
8 // Miguel de Icaza (miguel@ximian.com)
9 // Duncan Mak (duncan@ximian.com)
10 // Atsushi Enomoto (ginga@kit.hi-ho.ne.jp)
12 // (C) 2001 Daniel Weber
13 // (C) 2002 Kral Ferch, Jason Diamond, Miguel de Icaza, Duncan Mak,
20 using System.Xml.XPath;
21 using System.Diagnostics;
22 using System.Collections;
24 using Mono.Xml.Native;
28 public class XmlDocument : XmlNode
32 XmlLinkedNode lastLinkedChild;
33 XmlNameTable nameTable;
34 string baseURI = String.Empty;
35 XmlImplementation implementation;
36 bool preserveWhitespace = false;
43 public XmlDocument () : this (null, null)
47 protected internal XmlDocument (XmlImplementation imp) : this (imp, null)
51 public XmlDocument (XmlNameTable nt) : this (null, nt)
55 XmlDocument (XmlImplementation impl, XmlNameTable nt) : base (null)
57 implementation = (impl != null) ? impl : new XmlImplementation ();
58 nameTable = (nt != null) ? nt : implementation.internalNameTable;
59 AddDefaultNameTableKeys ();
65 public event XmlNodeChangedEventHandler NodeChanged;
67 public event XmlNodeChangedEventHandler NodeChanging;
69 public event XmlNodeChangedEventHandler NodeInserted;
71 public event XmlNodeChangedEventHandler NodeInserting;
73 public event XmlNodeChangedEventHandler NodeRemoved;
75 public event XmlNodeChangedEventHandler NodeRemoving;
81 public override string BaseURI {
87 public XmlElement DocumentElement {
89 XmlNode node = FirstChild;
91 while (node != null) {
92 if (node is XmlElement)
94 node = node.NextSibling;
97 return node != null ? node as XmlElement : null;
101 [MonoTODO("It doesn't have internal subset object model.")]
102 public virtual XmlDocumentType DocumentType {
104 foreach(XmlNode n in this.ChildNodes) {
105 if(n.NodeType == XmlNodeType.DocumentType)
106 return (XmlDocumentType)n;
112 public XmlImplementation Implementation {
113 get { return implementation; }
116 public override string InnerXml {
118 return base.InnerXml;
120 set { // reason for overriding
121 this.LoadXml (value);
125 public override bool IsReadOnly {
126 get { return false; }
129 internal override XmlLinkedNode LastLinkedChild {
131 return lastLinkedChild;
135 lastLinkedChild = value;
139 public override string LocalName {
140 get { return "#document"; }
143 public override string Name {
144 get { return "#document"; }
147 public XmlNameTable NameTable {
148 get { return nameTable; }
151 public override XmlNodeType NodeType {
152 get { return XmlNodeType.Document; }
155 internal override XPathNodeType XPathNodeType {
157 return XPathNodeType.Root;
161 public override XmlDocument OwnerDocument {
165 public bool PreserveWhitespace {
166 get { return preserveWhitespace; }
167 set { preserveWhitespace = value; }
170 internal override string XmlLang {
171 get { return String.Empty; }
174 public virtual XmlResolver XmlResolver {
175 set { resolver = value; }
178 internal override XmlSpace XmlSpace {
180 return XmlSpace.None;
188 public override XmlNode CloneNode (bool deep)
190 XmlDocument doc = implementation.CreateDocument ();
191 doc.baseURI = baseURI;
193 doc.PreserveWhitespace = PreserveWhitespace; // required?
196 foreach(XmlNode n in ChildNodes)
197 doc.AppendChild (doc.ImportNode (n, deep));
202 public XmlAttribute CreateAttribute (string name)
204 return CreateAttribute (name,
205 name == "xmlns" ? "http://www.w3.org/2000/xmlns/" : String.Empty);
208 public XmlAttribute CreateAttribute (string qualifiedName, string namespaceURI)
213 ParseName (qualifiedName, out prefix, out localName);
215 return CreateAttribute (prefix, localName, namespaceURI);
218 public virtual XmlAttribute CreateAttribute (string prefix, string localName, string namespaceURI)
220 if ((localName == null) || (localName == String.Empty))
221 throw new ArgumentException ("The attribute local name cannot be empty.");
223 return new XmlAttribute (prefix, localName, namespaceURI, this);
226 public virtual XmlCDataSection CreateCDataSection (string data)
228 return new XmlCDataSection (data, this);
231 public virtual XmlComment CreateComment (string data)
233 return new XmlComment (data, this);
236 protected internal virtual XmlAttribute CreateDefaultAttribute (string prefix, string localName, string namespaceURI)
238 XmlAttribute attr = CreateAttribute (prefix, localName, namespaceURI);
239 attr.isDefault = true;
243 public virtual XmlDocumentFragment CreateDocumentFragment ()
245 return new XmlDocumentFragment (this);
248 public virtual XmlDocumentType CreateDocumentType (string name, string publicId,
249 string systemId, string internalSubset)
251 return new XmlDocumentType (name, publicId, systemId, internalSubset, this);
254 private XmlDocumentType CreateDocumentType (XmlTextReader reader)
256 return new XmlDocumentType (reader, this);
259 public XmlElement CreateElement (string name)
261 return CreateElement (name, String.Empty);
264 public XmlElement CreateElement (
265 string qualifiedName,
271 ParseName (qualifiedName, out prefix, out localName);
273 return CreateElement (prefix, localName, namespaceURI);
276 public virtual XmlElement CreateElement (
281 if ((localName == null) || (localName == String.Empty))
282 throw new ArgumentException ("The local name for elements or attributes cannot be null or an empty string.");
283 CheckName (localName);
284 return new XmlElement (prefix != null ? prefix : String.Empty, localName, namespaceURI != null ? namespaceURI : String.Empty, this);
287 public virtual XmlEntityReference CreateEntityReference (string name)
289 return new XmlEntityReference (name, this);
292 protected internal virtual XPathNavigator CreateNavigator (XmlNode node)
294 return new XmlDocumentNavigator (node);
297 public virtual XmlNode CreateNode (
298 string nodeTypeString,
302 return CreateNode (GetNodeTypeFromString (nodeTypeString), name, namespaceURI);
305 public virtual XmlNode CreateNode (
310 string prefix = null;
311 string localName = name;
313 if ((type == XmlNodeType.Attribute) || (type == XmlNodeType.Element) || (type == XmlNodeType.EntityReference))
314 ParseName (name, out prefix, out localName);
316 return CreateNode (type, prefix, localName, namespaceURI);
319 public virtual XmlNode CreateNode (
326 case XmlNodeType.Attribute: return CreateAttribute (prefix, name, namespaceURI);
327 case XmlNodeType.CDATA: return CreateCDataSection (null);
328 case XmlNodeType.Comment: return CreateComment (null);
329 case XmlNodeType.Document: return new XmlDocument (); // TODO - test to see which constructor to use, i.e. use existing NameTable or not.
330 case XmlNodeType.DocumentFragment: return CreateDocumentFragment ();
331 case XmlNodeType.DocumentType: return CreateDocumentType (null, null, null, null);
332 case XmlNodeType.Element: return CreateElement (prefix, name, namespaceURI);
333 case XmlNodeType.EntityReference: return CreateEntityReference (null);
334 case XmlNodeType.ProcessingInstruction: return CreateProcessingInstruction (null, null);
335 case XmlNodeType.SignificantWhitespace: return CreateSignificantWhitespace (String.Empty);
336 case XmlNodeType.Text: return CreateTextNode (null);
337 case XmlNodeType.Whitespace: return CreateWhitespace (String.Empty);
338 case XmlNodeType.XmlDeclaration: return CreateXmlDeclaration ("1.0", null, null);
339 default: throw new ArgumentOutOfRangeException(String.Format("{0}\nParameter name: {1}",
340 "Specified argument was out of the range of valid values", type.ToString ()));
344 public virtual XmlProcessingInstruction CreateProcessingInstruction (
348 return new XmlProcessingInstruction (target, data, this);
351 public virtual XmlSignificantWhitespace CreateSignificantWhitespace (string text)
353 foreach (char c in text)
354 if ((c != ' ') && (c != '\r') && (c != '\n') && (c != '\t'))
355 throw new ArgumentException ("Invalid whitespace characters.");
357 return new XmlSignificantWhitespace (text, this);
360 public virtual XmlText CreateTextNode (string text)
362 return new XmlText (text, this);
365 public virtual XmlWhitespace CreateWhitespace (string text)
367 foreach (char c in text)
368 if ((c != ' ') && (c != '\r') && (c != '\n') && (c != '\t'))
369 throw new ArgumentException ("Invalid whitespace characters.");
371 return new XmlWhitespace (text, this);
374 public virtual XmlDeclaration CreateXmlDeclaration (string version, string encoding,
377 if (version != "1.0")
378 throw new ArgumentException ("version string is not correct.");
380 if ((standalone != null && standalone != String.Empty) && !((standalone == "yes") || (standalone == "no")))
381 throw new ArgumentException ("standalone string is not correct.");
383 return new XmlDeclaration (version, encoding, standalone, this);
387 public virtual XmlElement GetElementById (string elementId)
389 throw new NotImplementedException ();
392 public virtual XmlNodeList GetElementsByTagName (string name)
394 ArrayList nodeArrayList = new ArrayList ();
395 this.searchNodesRecursively (this, name, nodeArrayList);
396 return new XmlNodeArrayList (nodeArrayList);
399 private void searchNodesRecursively (XmlNode argNode, string argName,
400 ArrayList argArrayList)
402 XmlNodeList xmlNodeList = argNode.ChildNodes;
403 foreach (XmlNode node in xmlNodeList){
404 if (node.Name.Equals (argName))
405 argArrayList.Add (node);
407 this.searchNodesRecursively (node, argName, argArrayList);
411 private void searchNodesRecursively (XmlNode argNode, string argName, string argNamespaceURI,
412 ArrayList argArrayList)
414 XmlNodeList xmlNodeList = argNode.ChildNodes;
415 foreach (XmlNode node in xmlNodeList){
416 if (node.LocalName.Equals (argName) && node.NamespaceURI.Equals (argNamespaceURI))
417 argArrayList.Add (node);
419 this.searchNodesRecursively (node, argName, argNamespaceURI, argArrayList);
423 public virtual XmlNodeList GetElementsByTagName (string localName, string namespaceURI)
425 ArrayList nodeArrayList = new ArrayList ();
426 this.searchNodesRecursively (this, localName, namespaceURI, nodeArrayList);
427 return new XmlNodeArrayList (nodeArrayList);
430 private XmlNodeType GetNodeTypeFromString (string nodeTypeString)
432 switch (nodeTypeString) {
433 case "attribute": return XmlNodeType.Attribute;
434 case "cdatasection": return XmlNodeType.CDATA;
435 case "comment": return XmlNodeType.Comment;
436 case "document": return XmlNodeType.Document;
437 case "documentfragment": return XmlNodeType.DocumentFragment;
438 case "documenttype": return XmlNodeType.DocumentType;
439 case "element": return XmlNodeType.Element;
440 case "entityreference": return XmlNodeType.EntityReference;
441 case "processinginstruction": return XmlNodeType.ProcessingInstruction;
442 case "significantwhitespace": return XmlNodeType.SignificantWhitespace;
443 case "text": return XmlNodeType.Text;
444 case "whitespace": return XmlNodeType.Whitespace;
446 throw new ArgumentException(String.Format("The string doesn't represent any node type : {0}.", nodeTypeString));
450 [MonoTODO("default attributes (of imported doc); Entity; Notation")]
451 public virtual XmlNode ImportNode (XmlNode node, bool deep)
453 switch(node.NodeType)
455 case XmlNodeType.Attribute:
457 XmlAttribute src_att = node as XmlAttribute;
458 XmlAttribute dst_att = this.CreateAttribute (src_att.Prefix, src_att.LocalName, src_att.NamespaceURI);
459 dst_att.Value = src_att.Value; // always explicitly specified (whether source is specified or not)
463 case XmlNodeType.CDATA:
464 return this.CreateCDataSection (node.Value);
466 case XmlNodeType.Comment:
467 return this.CreateComment (node.Value);
469 case XmlNodeType.Document:
470 throw new XmlException ("Document cannot be imported.");
472 case XmlNodeType.DocumentFragment:
474 XmlDocumentFragment df = this.CreateDocumentFragment ();
477 foreach(XmlNode n in node.ChildNodes)
479 df.AppendChild (this.ImportNode (n, deep));
485 case XmlNodeType.DocumentType:
486 throw new XmlException ("DocumentType cannot be imported.");
488 case XmlNodeType.Element:
490 XmlElement src = (XmlElement)node;
491 XmlElement dst = this.CreateElement (src.Prefix, src.LocalName, src.NamespaceURI);
492 foreach(XmlAttribute attr in src.Attributes)
494 if(attr.Specified) // copies only specified attributes
495 dst.SetAttributeNode ((XmlAttribute)this.ImportNode (attr, deep));
496 if(DocumentType != null)
498 // TODO: create default attribute values
503 foreach(XmlNode n in src.ChildNodes)
504 dst.AppendChild (this.ImportNode (n, deep));
509 case XmlNodeType.EndElement:
510 throw new XmlException ("Illegal ImportNode call for NodeType.EndElement");
511 case XmlNodeType.EndEntity:
512 throw new XmlException ("Illegal ImportNode call for NodeType.EndEntity");
514 case XmlNodeType.Entity:
515 throw new NotImplementedException (); // TODO
517 case XmlNodeType.EntityReference:
518 return this.CreateEntityReference (node.Name);
520 case XmlNodeType.None:
521 throw new XmlException ("Illegal ImportNode call for NodeType.None");
523 case XmlNodeType.Notation:
524 throw new NotImplementedException (); // TODO
526 case XmlNodeType.ProcessingInstruction:
527 XmlProcessingInstruction pi = node as XmlProcessingInstruction;
528 return this.CreateProcessingInstruction (pi.Target, pi.Data);
530 case XmlNodeType.SignificantWhitespace:
531 return this.CreateSignificantWhitespace (node.Value);
533 case XmlNodeType.Text:
534 return this.CreateTextNode (node.Value);
536 case XmlNodeType.Whitespace:
537 return this.CreateWhitespace (node.Value);
539 case XmlNodeType.XmlDeclaration:
540 XmlDeclaration srcDecl = node as XmlDeclaration;
541 return this.CreateXmlDeclaration (srcDecl.Version, srcDecl.Encoding, srcDecl.Standalone);
544 throw new NotImplementedException ();
548 public virtual void Load (Stream inStream)
550 Load (new XmlTextReader (inStream));
553 public virtual void Load (string filename)
555 XmlReader xr = new XmlTextReader (filename);
560 public virtual void Load (TextReader txtReader)
562 Load (new XmlTextReader (txtReader));
565 public virtual void Load (XmlReader xmlReader)
567 // Reset our document
568 // For now this just means removing all our children but later this
569 // may turn out o need to call a private method that resets other things
570 // like properties we have, etc.
573 this.baseURI = xmlReader.BaseURI;
574 // create all contents with use of ReadNode()
576 XmlNode n = ReadNode (xmlReader);
582 public virtual void LoadXml (string xml)
584 XmlReader xmlReader = new XmlTextReader (
585 xml, XmlNodeType.Document, null);
589 internal void onNodeChanged (XmlNode node, XmlNode Parent)
591 if (NodeChanged != null)
592 NodeChanged (node, new XmlNodeChangedEventArgs
593 (XmlNodeChangedAction.Change,
594 node, Parent, Parent));
597 internal void onNodeChanging(XmlNode node, XmlNode Parent)
599 if (NodeChanging != null)
600 NodeChanging (node, new XmlNodeChangedEventArgs
601 (XmlNodeChangedAction.Change,
602 node, Parent, Parent));
605 internal void onNodeInserted (XmlNode node, XmlNode newParent)
607 if (NodeInserted != null)
608 NodeInserted (node, new XmlNodeChangedEventArgs
609 (XmlNodeChangedAction.Insert,
610 node, null, newParent));
613 internal void onNodeInserting (XmlNode node, XmlNode newParent)
615 if (NodeInserting != null)
616 NodeInserting (node, new XmlNodeChangedEventArgs
617 (XmlNodeChangedAction.Insert,
618 node, null, newParent));
621 internal void onNodeRemoved (XmlNode node, XmlNode oldParent)
623 if (NodeRemoved != null)
624 NodeRemoved (node, new XmlNodeChangedEventArgs
625 (XmlNodeChangedAction.Remove,
626 node, oldParent, null));
629 internal void onNodeRemoving (XmlNode node, XmlNode oldParent)
631 if (NodeRemoving != null)
632 NodeRemoving (node, new XmlNodeChangedEventArgs
633 (XmlNodeChangedAction.Remove,
634 node, oldParent, null));
637 private void ParseName (string name, out string prefix, out string localName)
639 int indexOfColon = name.IndexOf (':');
641 if (indexOfColon != -1) {
642 prefix = name.Substring (0, indexOfColon);
643 localName = name.Substring (indexOfColon + 1);
650 // Checks that Element's name is valid
651 private void CheckName (String name)
653 // TODO: others validations?
654 if (name.IndexOf (" ") >= 0)
655 throw new XmlException ("The ' ' characted cannot be included in a name");
658 // Reads XmlReader and creates Attribute Node.
659 private XmlAttribute ReadAttributeNode(XmlReader reader)
661 if(reader.NodeType == XmlNodeType.Element)
662 reader.MoveToFirstAttribute ();
663 else if(reader.NodeType != XmlNodeType.Attribute)
664 throw new InvalidOperationException (MakeReaderErrorMessage ("bad position to read attribute.", reader));
665 XmlAttribute attribute = CreateAttribute (reader.Prefix, reader.LocalName, reader.NamespaceURI);
666 ReadAttributeNodeValue (reader, attribute);
668 // Keep the current reader position
670 if (attribute.NamespaceURI == string.Empty || attribute.NamespaceURI == null)
671 res = reader.MoveToAttribute (attribute.Name);
673 res = reader.MoveToAttribute (attribute.LocalName, attribute.NamespaceURI);
677 // Reads attribute from XmlReader and then creates attribute value children. XmlAttribute also uses this.
678 internal void ReadAttributeNodeValue(XmlReader reader, XmlAttribute attribute)
680 while(reader.ReadAttributeValue ()) {
681 if(reader.NodeType == XmlNodeType.EntityReference)
682 // FIXME: if DocumentType is available, then try to resolve it.
683 attribute.AppendChild (CreateEntityReference (reader.Name));
684 // FIXME: else if(NodeType == EndEntity) -- reset BaseURI and so on -- ;
686 // Children of Attribute is restricted to CharacterData and EntityReference (Comment is not allowed).
687 attribute.AppendChild (CreateTextNode (reader.Value));
691 [MonoTODO ("Child of entity is not simple Value string;Get prefix of NotationDecl")]
692 public virtual XmlNode ReadNode(XmlReader reader)
694 XmlNode resultNode = null;
695 XmlNode newNode = null;
696 XmlNode currentNode = null;
698 if (reader.ReadState == ReadState.Initial)
701 int startDepth = reader.Depth;
702 bool ignoredWhitespace;
703 bool reachedEOF = false;
706 ignoredWhitespace = false;
707 if (reader.NodeType == XmlNodeType.None)
709 throw new Exception ("XML Reader reached to end while reading node.");
712 switch (reader.NodeType) {
714 case XmlNodeType.Attribute:
715 newNode = ReadAttributeNode (reader);
718 case XmlNodeType.CDATA:
719 newNode = CreateCDataSection (reader.Value);
720 if(currentNode != null)
721 currentNode.AppendChild (newNode);
724 case XmlNodeType.Comment:
725 newNode = CreateComment (reader.Value);
726 if(currentNode != null)
727 currentNode.AppendChild (newNode);
730 case XmlNodeType.Element:
731 XmlElement element = CreateElement (reader.Prefix, reader.LocalName, reader.NamespaceURI);
732 element.IsEmpty = reader.IsEmptyElement;
733 if(currentNode != null)
734 currentNode.AppendChild (element);
736 resultNode = element;
738 // set the element's attributes.
739 while (reader.MoveToNextAttribute ()) {
740 element.SetAttributeNode (ReadAttributeNode (reader));
743 reader.MoveToElement ();
745 if (!reader.IsEmptyElement)
746 currentNode = element;
750 case XmlNodeType.EndElement:
751 if (currentNode == null)
752 throw new XmlException ("Unexpected end element.");
753 else if (currentNode.Name != reader.Name)
754 throw new XmlException (reader as IXmlLineInfo, String.Format ("mismatch end tag. Expected {0} but found {1}", currentNode.Name, reader.Name));
755 currentNode = currentNode.ParentNode;
758 case XmlNodeType.EndEntity:
759 break; // no operation
761 case XmlNodeType.ProcessingInstruction:
762 newNode = CreateProcessingInstruction (reader.Name, reader.Value);
763 if(currentNode != null)
764 currentNode.AppendChild (newNode);
767 case XmlNodeType.Text:
768 newNode = CreateTextNode (reader.Value);
769 if(currentNode != null)
770 currentNode.AppendChild (newNode);
773 case XmlNodeType.XmlDeclaration:
774 // empty strings are dummy, then gives over setting value contents to setter.
775 newNode = CreateXmlDeclaration ("1.0" , String.Empty, String.Empty);
776 ((XmlDeclaration)newNode).Value = reader.Value;
777 if(currentNode != null)
778 throw new XmlException (reader as IXmlLineInfo, "XmlDeclaration at invalid position.");
781 case XmlNodeType.DocumentType:
783 XmlTextReader xtReader = reader as XmlTextReader;
785 newNode = CreateDocumentType (reader.Name, reader ["PUBLIC"], reader ["SYSTEM"], reader.Value);
787 newNode = CreateDocumentType (xtReader);
789 if(currentNode != null)
790 throw new XmlException (reader as IXmlLineInfo, "XmlDocumentType at invalid position.");
793 case XmlNodeType.EntityReference:
794 newNode = CreateEntityReference (reader.Name);
795 if(currentNode != null)
796 currentNode.AppendChild (newNode);
799 case XmlNodeType.SignificantWhitespace:
800 newNode = CreateSignificantWhitespace (reader.Value);
801 if(currentNode != null)
802 currentNode.AppendChild (newNode);
805 case XmlNodeType.Whitespace:
806 if(PreserveWhitespace) {
807 newNode = CreateWhitespace (reader.Value);
808 if(currentNode != null)
809 currentNode.AppendChild (newNode);
812 ignoredWhitespace = true;
815 if (!(newNode is XmlAttribute) && !reader.Read ())
817 } while (ignoredWhitespace || reader.Depth > startDepth ||
818 (reader.Depth == startDepth && reader.NodeType == XmlNodeType.EndElement));
819 if (startDepth != reader.Depth && reader.EOF)
820 throw new XmlException ("Unexpected end of xml reader.");
821 return resultNode != null ? resultNode : newNode;
824 private string MakeReaderErrorMessage (string message, XmlReader reader)
826 IXmlLineInfo li = reader as IXmlLineInfo;
828 return String.Format ("{0} Line number = {1}, Inline position = {2}.", message, li.LineNumber, li.LinePosition);
833 public virtual void Save(Stream outStream)
835 XmlTextWriter xmlWriter = new XmlTextWriter (outStream, Encoding.UTF8);
836 xmlWriter.Formatting = Formatting.Indented;
837 WriteContentTo (xmlWriter);
841 public virtual void Save (string filename)
843 XmlTextWriter xmlWriter = new XmlTextWriter (filename, Encoding.UTF8);
844 xmlWriter.Formatting = Formatting.Indented;
845 WriteContentTo (xmlWriter);
849 public virtual void Save (TextWriter writer)
851 XmlTextWriter xmlWriter = new XmlTextWriter (writer);
852 xmlWriter.Formatting = Formatting.Indented;
853 WriteContentTo (xmlWriter);
857 public virtual void Save (XmlWriter xmlWriter)
860 // This should preserve white space if PreserveWhiteSpace is true
862 WriteContentTo (xmlWriter);
866 public override void WriteContentTo (XmlWriter w)
868 foreach(XmlNode childNode in ChildNodes) {
869 childNode.WriteTo (w);
873 public override void WriteTo (XmlWriter w)
878 private void AddDefaultNameTableKeys ()
880 // The following keys are default of MS .NET Framework
881 nameTable.Add ("#text");
882 nameTable.Add ("xml");
883 nameTable.Add ("xmlns");
884 nameTable.Add ("#entity");
885 nameTable.Add ("#document-fragment");
886 nameTable.Add ("#comment");
887 nameTable.Add ("space");
888 nameTable.Add ("id");
889 nameTable.Add ("#whitespace");
890 nameTable.Add ("http://www.w3.org/2000/xmlns/");
891 nameTable.Add ("#cdata-section");
892 nameTable.Add ("lang");
893 nameTable.Add ("#document");
894 nameTable.Add ("#significant-whitespace");