17 private DomNameTable domNameTable;
31 private bool reportValidity;
33 private bool actualLoadingStatus;
47 internal bool fEntRefNodesPresent;
49 internal bool fCDataNodesPresent;
51 private bool preserveWhitespace;
53 private bool isLoading;
55 internal string strDocumentName;
57 internal string strDocumentFragmentName;
59 internal string strCommentName;
61 internal string strTextName;
63 internal string strCDataSectionName;
65 internal string strEntityName;
67 internal string strID;
69 internal string strXmlns;
71 internal string strXml;
73 internal string strSpace;
75 internal string strLang;
77 internal string strEmpty;
79 internal string strNonSignificantWhitespaceName;
81 internal string strSignificantWhitespaceName;
83 internal string strReservedXmlns;
85 internal string strReservedXml;
87 internal string baseURI;
91 internal bool bSetResolver;
93 internal object objLock;
97 internal static EmptyEnumerator EmptyEnumerator =
new EmptyEnumerator();
147 public override string Name => strDocumentName;
157 internal override bool IsContainer =>
true;
193 internal bool CanReportValidity => reportValidity;
195 internal bool HasSetResolver => bSetResolver;
212 throw new SecurityException(Res.GetString(
"Xml_UntrustedCodeSettingResolver"), inner);
221 if (documentType !=
null)
223 documentType.DtdSchemaInfo =
null;
239 return preserveWhitespace;
243 preserveWhitespace = value;
256 if (entities ==
null)
268 internal bool IsLoading
280 internal bool ActualLoadingStatus
284 return actualLoadingStatus;
288 actualLoadingStatus = value;
296 if (Declaration !=
null)
298 string encoding = Declaration.
Encoding;
299 if (encoding.Length > 0)
327 return base.InnerXml;
339 internal string Standalone => Declaration?.Standalone;
350 if (documentElement !=
null)
355 return ValidSchemaInfo;
357 return InvalidSchemaInfo;
361 return NotKnownSchemaInfo;
371 internal bool HasEntityReferences => fEntRefNodesPresent;
377 if (namespaceXml ==
null)
379 namespaceXml =
new XmlAttribute(AddAttrXmlName(strXmlns, strXml, strReservedXmlns,
null),
this);
380 namespaceXml.
Value = strReservedXml;
481 implementation = imp;
482 domNameTable =
new DomNameTable(
this);
484 nameTable.
Add(
string.Empty);
485 strDocumentName = nameTable.
Add(
"#document");
486 strDocumentFragmentName = nameTable.
Add(
"#document-fragment");
487 strCommentName = nameTable.
Add(
"#comment");
488 strTextName = nameTable.
Add(
"#text");
489 strCDataSectionName = nameTable.
Add(
"#cdata-section");
490 strEntityName = nameTable.
Add(
"#entity");
491 strID = nameTable.
Add(
"id");
492 strNonSignificantWhitespaceName = nameTable.
Add(
"#whitespace");
493 strSignificantWhitespaceName = nameTable.
Add(
"#significant-whitespace");
494 strXmlns = nameTable.
Add(
"xmlns");
495 strXml = nameTable.
Add(
"xml");
496 strSpace = nameTable.
Add(
"space");
497 strLang = nameTable.
Add(
"lang");
498 strReservedXmlns = nameTable.
Add(
"http://www.w3.org/2000/xmlns/");
499 strReservedXml = nameTable.
Add(
"http://www.w3.org/XML/1998/namespace");
500 strEmpty = nameTable.
Add(
string.Empty);
501 baseURI =
string.Empty;
502 objLock =
new object();
505 internal static void CheckName(
string name)
507 int num = ValidateNames.ParseNmtoken(name, 0);
508 if (num < name.Length)
514 internal XmlName AddXmlName(
string prefix,
string localName,
string namespaceURI,
IXmlSchemaInfo schemaInfo)
516 return domNameTable.AddName(prefix, localName, namespaceURI, schemaInfo);
519 internal XmlName GetXmlName(
string prefix,
string localName,
string namespaceURI,
IXmlSchemaInfo schemaInfo)
521 return domNameTable.GetName(prefix, localName, namespaceURI, schemaInfo);
524 internal XmlName AddAttrXmlName(
string prefix,
string localName,
string namespaceURI,
IXmlSchemaInfo schemaInfo)
526 XmlName xmlName = AddXmlName(prefix, localName, namespaceURI, schemaInfo);
529 object prefix2 = xmlName.Prefix;
530 object namespaceURI2 = xmlName.NamespaceURI;
531 object localName2 = xmlName.LocalName;
532 if ((prefix2 == strXmlns || (prefix2 == strEmpty && localName2 == strXmlns)) ^ (namespaceURI2 == strReservedXmlns))
534 throw new ArgumentException(Res.GetString(
"Xdom_Attr_Reserved_XmlNS", namespaceURI));
540 internal bool AddIdInfo(XmlName eleName, XmlName attrName)
542 if (htElementIDAttrDecl ==
null || htElementIDAttrDecl[eleName] ==
null)
544 if (htElementIDAttrDecl ==
null)
548 htElementIDAttrDecl.
Add(eleName, attrName);
554 private XmlName GetIDInfoByElement_(XmlName eleName)
556 XmlName xmlName = GetXmlName(eleName.Prefix, eleName.LocalName,
string.Empty,
null);
559 return (XmlName)htElementIDAttrDecl[xmlName];
564 internal XmlName GetIDInfoByElement(XmlName eleName)
566 if (htElementIDAttrDecl ==
null)
570 return GetIDInfoByElement_(eleName);
573 private WeakReference GetElement(
ArrayList elementList, XmlElement elem)
576 foreach (WeakReference element
in elementList)
578 if (!element.IsAlive)
580 arrayList.
Add(element);
582 else if ((XmlElement)element.Target == elem)
587 foreach (WeakReference item
in arrayList)
589 elementList.Remove(item);
594 internal void AddElementWithId(
string id, XmlElement elem)
596 if (htElementIdMap ==
null || !htElementIdMap.
Contains(
id))
598 if (htElementIdMap ==
null)
603 arrayList.
Add(
new WeakReference(elem));
604 htElementIdMap.
Add(
id, arrayList);
609 if (GetElement(arrayList2, elem) ==
null)
611 arrayList2.
Add(
new WeakReference(elem));
616 internal void RemoveElementWithId(
string id, XmlElement elem)
618 if (htElementIdMap ==
null || !htElementIdMap.
Contains(
id))
623 WeakReference element = GetElement(arrayList, elem);
626 arrayList.
Remove(element);
627 if (arrayList.
Count == 0)
629 htElementIdMap.
Remove(
id);
641 xmlDocument.SetBaseURI(baseURI);
644 xmlDocument.ImportChildren(
this, xmlDocument, deep);
654 internal override bool IsValidChildType(
XmlNodeType type)
672 throw new InvalidOperationException(Res.GetString(
"Xdom_DualDocumentElementNode"));
676 if (Declaration !=
null)
678 throw new InvalidOperationException(Res.GetString(
"Xdom_DualDeclarationNode"));
686 private bool HasNodeTypeInPrevSiblings(
XmlNodeType nt, XmlNode refNode)
692 XmlNode xmlNode =
null;
693 if (refNode.ParentNode !=
null)
695 xmlNode = refNode.ParentNode.FirstChild;
697 while (xmlNode !=
null)
699 if (xmlNode.NodeType == nt)
703 if (xmlNode == refNode)
707 xmlNode = xmlNode.NextSibling;
712 private bool HasNodeTypeInNextSiblings(
XmlNodeType nt, XmlNode refNode)
714 for (XmlNode xmlNode = refNode; xmlNode !=
null; xmlNode = xmlNode.NextSibling)
716 if (xmlNode.NodeType == nt)
724 internal override bool CanInsertBefore(XmlNode newChild, XmlNode refChild)
726 if (refChild ==
null)
730 if (refChild ==
null)
734 switch (newChild.NodeType)
740 return refChild.NodeType !=
XmlNodeType.XmlDeclaration;
742 if (refChild.NodeType !=
XmlNodeType.XmlDeclaration)
744 return !HasNodeTypeInPrevSiblings(
XmlNodeType.Element, refChild.PreviousSibling);
748 if (refChild.NodeType !=
XmlNodeType.XmlDeclaration)
750 return !HasNodeTypeInNextSiblings(
XmlNodeType.DocumentType, refChild);
757 internal override bool CanInsertAfter(XmlNode newChild, XmlNode refChild)
759 if (refChild ==
null)
763 if (refChild ==
null)
767 switch (newChild.NodeType)
775 return !HasNodeTypeInPrevSiblings(
XmlNodeType.Element, refChild);
777 return !HasNodeTypeInNextSiblings(
XmlNodeType.DocumentType, refChild.NextSibling);
788 string prefix =
string.Empty;
789 string localName =
string.Empty;
790 string namespaceURI =
string.Empty;
791 XmlNode.SplitName(name, out prefix, out localName);
792 SetDefaultNamespace(prefix, localName, ref namespaceURI);
796 internal void SetDefaultNamespace(
string prefix,
string localName, ref
string namespaceURI)
798 if (prefix == strXmlns || (prefix.Length == 0 && localName == strXmlns))
800 namespaceURI = strReservedXmlns;
802 else if (prefix == strXml)
804 namespaceURI = strReservedXml;
813 fCDataNodesPresent =
true;
834 return new XmlDocumentType(name, publicId, systemId, internalSubset,
this);
849 string prefix =
string.Empty;
850 string localName =
string.Empty;
851 XmlNode.SplitName(name, out prefix, out localName);
855 internal void AddDefaultAttributes(
XmlElement elem)
858 SchemaElementDecl schemaElementDecl = GetSchemaElementDecl(elem);
859 if (schemaElementDecl ==
null || schemaElementDecl.AttDefs ==
null)
864 while (dictionaryEnumerator.
MoveNext())
866 SchemaAttDef schemaAttDef = (SchemaAttDef)dictionaryEnumerator.
Value;
867 if (schemaAttDef.Presence == SchemaDeclBase.Use.Default || schemaAttDef.Presence == SchemaDeclBase.Use.Fixed)
869 string empty =
string.Empty;
870 string name = schemaAttDef.Name.Name;
871 string attrNamespaceURI =
string.Empty;
872 if (dtdSchemaInfo.SchemaType == SchemaType.DTD)
874 empty = schemaAttDef.Name.Namespace;
878 empty = schemaAttDef.Prefix;
879 attrNamespaceURI = schemaAttDef.Name.Namespace;
881 XmlAttribute attributeNode = PrepareDefaultAttribute(schemaAttDef, empty, name, attrNamespaceURI);
887 private SchemaElementDecl GetSchemaElementDecl(XmlElement elem)
890 if (dtdSchemaInfo !=
null)
892 XmlQualifiedName key =
new XmlQualifiedName(elem.LocalName, (dtdSchemaInfo.SchemaType == SchemaType.DTD) ? elem.Prefix : elem.NamespaceURI);
893 if (dtdSchemaInfo.ElementDecls.TryGetValue(key, out SchemaElementDecl value))
901 private XmlAttribute PrepareDefaultAttribute(SchemaAttDef attdef,
string attrPrefix,
string attrLocalname,
string attrNamespaceURI)
903 SetDefaultNamespace(attrPrefix, attrLocalname, ref attrNamespaceURI);
905 xmlAttribute.InnerXml = attdef.DefaultValueRaw;
906 (xmlAttribute as XmlUnspecifiedAttribute)?.SetSpecified(f:
false);
944 return new XmlText(text,
this);
980 if (parentNode !=
null)
995 while (parentNode !=
null);
997 node = NormalizeText(node);
1003 if (parentNode !=
null)
1019 while (parentNode !=
null);
1021 node = NormalizeText(node);
1025 return new DocumentXPathNavigator(
this, node);
1042 private XmlNode NormalizeText(XmlNode n)
1044 XmlNode xmlNode =
null;
1045 while (IsTextNode(n.NodeType))
1048 n = n.PreviousSibling;
1051 XmlNode xmlNode2 = xmlNode;
1052 while (xmlNode2.ParentNode !=
null && xmlNode2.ParentNode.NodeType ==
XmlNodeType.EntityReference)
1054 if (xmlNode2.ParentNode.PreviousSibling !=
null)
1056 n = xmlNode2.ParentNode.PreviousSibling;
1059 xmlNode2 = xmlNode2.ParentNode;
1060 if (xmlNode2 ==
null)
1091 return new XmlElementList(
this, name);
1100 string prefix =
string.Empty;
1101 string localName =
string.Empty;
1102 XmlNode.SplitName(qualifiedName, out prefix, out localName);
1112 string prefix =
string.Empty;
1113 string localName =
string.Empty;
1114 XmlNode.SplitName(qualifiedName, out prefix, out localName);
1124 return new XmlElementList(
this, localName, namespaceURI);
1132 if (htElementIdMap !=
null)
1135 if (arrayList !=
null)
1140 if (xmlElement !=
null && xmlElement.IsConnected())
1158 return ImportNodeInternal(node, deep);
1172 ImportAttributes(node, xmlNode);
1175 ImportChildren(node, xmlNode, deep);
1180 ImportChildren(node, xmlNode, deep:
true);
1194 xmlNode =
CreateXmlDeclaration(xmlDeclaration.Version, xmlDeclaration.Encoding, xmlDeclaration.Standalone);
1202 XmlDocumentType xmlDocumentType = (XmlDocumentType)node;
1203 xmlNode =
CreateDocumentType(xmlDocumentType.Name, xmlDocumentType.PublicId, xmlDocumentType.SystemId, xmlDocumentType.InternalSubset);
1210 ImportChildren(node, xmlNode, deep);
1231 private void ImportAttributes(XmlNode fromElem, XmlNode toElem)
1233 int count = fromElem.Attributes.Count;
1234 for (
int i = 0; i < count; i++)
1236 if (fromElem.Attributes[i].Specified)
1238 toElem.Attributes.SetNamedItem(ImportNodeInternal(fromElem.Attributes[i], deep:
true));
1243 private void ImportChildren(XmlNode fromNode, XmlNode toNode,
bool deep)
1245 for (XmlNode xmlNode = fromNode.FirstChild; xmlNode !=
null; xmlNode = xmlNode.
NextSibling)
1247 toNode.AppendChild(ImportNodeInternal(xmlNode, deep));
1258 return new XmlAttribute(AddAttrXmlName(prefix, localName, namespaceURI,
null),
this);
1268 return new XmlUnspecifiedAttribute(prefix, localName, namespaceURI,
this);
1278 XmlElement xmlElement =
new XmlElement(AddXmlName(prefix, localName, namespaceURI,
null), empty:
true,
this);
1281 AddDefaultAttributes(xmlElement);
1344 return CreateNode(ConvertToNodeType(nodeTypeString), name, namespaceURI);
1355 return CreateNode(type,
null, name, namespaceURI);
1369 XmlLoader xmlLoader =
new XmlLoader();
1370 return xmlLoader.ReadCurrentNode(
this, reader);
1378 internal XmlNodeType ConvertToNodeType(
string nodeTypeString)
1380 if (nodeTypeString ==
"element")
1384 if (nodeTypeString ==
"attribute")
1388 if (nodeTypeString ==
"text")
1392 if (nodeTypeString ==
"cdatasection")
1396 if (nodeTypeString ==
"entityreference")
1400 if (nodeTypeString ==
"entity")
1404 if (nodeTypeString ==
"processinginstruction")
1408 if (nodeTypeString ==
"comment")
1412 if (nodeTypeString ==
"document")
1416 if (nodeTypeString ==
"documenttype")
1420 if (nodeTypeString ==
"documentfragment")
1424 if (nodeTypeString ==
"notation")
1428 if (nodeTypeString ==
"significantwhitespace")
1432 if (nodeTypeString ==
"whitespace")
1436 throw new ArgumentException(Res.GetString(
"Xdom_Invalid_NT_String", nodeTypeString));
1439 private XmlTextReader SetupReader(XmlTextReader tr)
1441 tr.XmlValidatingReaderCompatibilityMode =
true;
1445 tr.XmlResolver = GetResolver();
1467 public virtual void Load(
string filename)
1472 Load(xmlTextReader);
1476 xmlTextReader.
Close();
1488 Load(xmlTextReader);
1492 xmlTextReader.Impl.Close(closeInput:
false);
1504 Load(xmlTextReader);
1508 xmlTextReader.Impl.Close(closeInput:
false);
1520 actualLoadingStatus =
true;
1522 fEntRefNodesPresent =
false;
1523 fCDataNodesPresent =
false;
1524 reportValidity =
true;
1525 XmlLoader xmlLoader =
new XmlLoader();
1526 xmlLoader.Load(
this, reader, preserveWhitespace);
1531 actualLoadingStatus =
false;
1532 reportValidity =
true;
1544 Load(xmlTextReader);
1548 xmlTextReader.
Close();
1555 public virtual void Save(
string filename)
1559 throw new XmlException(
"Xml_InvalidXmlDocument", Res.GetString(
"Xdom_NoRootEle"));
1561 XmlDOMTextWriter xmlDOMTextWriter =
new XmlDOMTextWriter(filename, TextEncoding);
1564 if (!preserveWhitespace)
1566 xmlDOMTextWriter.Formatting =
Formatting.Indented;
1569 xmlDOMTextWriter.Flush();
1573 xmlDOMTextWriter.Close();
1582 XmlDOMTextWriter xmlDOMTextWriter =
new XmlDOMTextWriter(outStream, TextEncoding);
1583 if (!preserveWhitespace)
1585 xmlDOMTextWriter.Formatting =
Formatting.Indented;
1588 xmlDOMTextWriter.Flush();
1596 XmlDOMTextWriter xmlDOMTextWriter =
new XmlDOMTextWriter(writer);
1597 if (!preserveWhitespace)
1599 xmlDOMTextWriter.Formatting =
Formatting.Indented;
1601 Save(xmlDOMTextWriter);
1610 if (xmlNode ==
null)
1618 if (Standalone.Length == 0)
1622 else if (Standalone ==
"yes")
1626 else if (Standalone ==
"no")
1637 while (xmlNode !=
null)
1668 if (disposable !=
null)
1678 public void Validate(ValidationEventHandler validationEventHandler)
1680 Validate(validationEventHandler,
this);
1689 public void Validate(ValidationEventHandler validationEventHandler,
XmlNode nodeToValidate)
1691 if (schemas ==
null || schemas.
Count == 0)
1696 if (document !=
this)
1698 throw new ArgumentException(Res.GetString(
"XmlDocument_NodeNotFromDocument",
"nodeToValidate"));
1700 if (nodeToValidate ==
this)
1702 reportValidity =
false;
1704 DocumentSchemaValidator documentSchemaValidator =
new DocumentSchemaValidator(
this, schemas, validationEventHandler);
1705 documentSchemaValidator.Validate(nodeToValidate);
1706 if (nodeToValidate ==
this)
1708 reportValidity =
true;
1714 reportValidity =
false;
1718 if (onNodeInsertingDelegate ==
null && onNodeInsertedDelegate ==
null)
1724 if (onNodeRemovingDelegate ==
null && onNodeRemovedDelegate ==
null)
1730 if (onNodeChangingDelegate ==
null && onNodeChangedDelegate ==
null)
1736 return new XmlNodeChangedEventArgs(node, oldParent, newParent, oldValue, newValue, action);
1739 internal XmlNodeChangedEventArgs GetInsertEventArgsForLoad(XmlNode node, XmlNode newParent)
1741 if (onNodeInsertingDelegate ==
null && onNodeInsertedDelegate ==
null)
1745 string value = node.Value;
1746 return new XmlNodeChangedEventArgs(node,
null, newParent, value, value,
XmlNodeChangedAction.Insert);
1749 internal override void BeforeEvent(XmlNodeChangedEventArgs args)
1755 switch (args.Action)
1758 if (onNodeInsertingDelegate !=
null)
1760 onNodeInsertingDelegate(
this, args);
1764 if (onNodeRemovingDelegate !=
null)
1766 onNodeRemovingDelegate(
this, args);
1770 if (onNodeChangingDelegate !=
null)
1772 onNodeChangingDelegate(
this, args);
1778 internal override void AfterEvent(XmlNodeChangedEventArgs args)
1784 switch (args.Action)
1787 if (onNodeInsertedDelegate !=
null)
1789 onNodeInsertedDelegate(
this, args);
1793 if (onNodeRemovedDelegate !=
null)
1795 onNodeRemovedDelegate(
this, args);
1799 if (onNodeChangedDelegate !=
null)
1801 onNodeChangedDelegate(
this, args);
1807 internal XmlAttribute GetDefaultAttribute(XmlElement elem,
string attrPrefix,
string attrLocalname,
string attrNamespaceURI)
1810 SchemaElementDecl schemaElementDecl = GetSchemaElementDecl(elem);
1811 if (schemaElementDecl !=
null && schemaElementDecl.AttDefs !=
null)
1814 while (dictionaryEnumerator.
MoveNext())
1816 SchemaAttDef schemaAttDef = (SchemaAttDef)dictionaryEnumerator.
Value;
1817 if ((schemaAttDef.Presence == SchemaDeclBase.Use.Default || schemaAttDef.Presence == SchemaDeclBase.Use.Fixed) && schemaAttDef.Name.Name == attrLocalname && ((dtdSchemaInfo.SchemaType == SchemaType.DTD && schemaAttDef.Name.Namespace == attrPrefix) || (dtdSchemaInfo.SchemaType != SchemaType.DTD && schemaAttDef.Name.Namespace == attrNamespaceURI)))
1819 return PrepareDefaultAttribute(schemaAttDef, attrPrefix, attrLocalname, attrNamespaceURI);
1826 internal XmlEntity GetEntityNode(
string name)
1831 if (xmlNamedNodeMap !=
null)
1839 internal void SetBaseURI(
string inBaseURI)
1841 baseURI = inBaseURI;
1844 internal override XmlNode AppendChildForLoad(XmlNode newChild,
XmlDocument doc)
1846 if (!IsValidChildType(newChild.NodeType))
1848 throw new InvalidOperationException(Res.GetString(
"Xdom_Node_Insert_TypeConflict"));
1850 if (!CanInsertAfter(newChild,
LastChild))
1852 throw new InvalidOperationException(Res.GetString(
"Xdom_Node_Insert_Location"));
1854 XmlNodeChangedEventArgs insertEventArgsForLoad = GetInsertEventArgsForLoad(newChild,
this);
1855 if (insertEventArgsForLoad !=
null)
1857 BeforeEvent(insertEventArgsForLoad);
1859 XmlLinkedNode xmlLinkedNode = (XmlLinkedNode)newChild;
1860 if (lastChild ==
null)
1862 xmlLinkedNode.next = xmlLinkedNode;
1866 xmlLinkedNode.next = lastChild.next;
1867 lastChild.next = xmlLinkedNode;
1869 lastChild = xmlLinkedNode;
1870 xmlLinkedNode.SetParentForLoad(
this);
1871 if (insertEventArgsForLoad !=
null)
1873 AfterEvent(insertEventArgsForLoad);
1875 return xmlLinkedNode;
Represents a character encoding.To browse the .NET Framework source code for this type,...
static CultureInfo InvariantCulture
Gets the T:System.Globalization.CultureInfo object that is culture-independent (invariant).
WriteState
Specifies the state of the T:System.Xml.XmlWriter.
The XML declaration (for example, <?xml version='1.0'?> ).
delegate void XmlNodeChangedEventHandler(object sender, XmlNodeChangedEventArgs e)
Represents the method that handles E:System.Xml.XmlDocument.NodeChanged, E:System....
virtual XmlDocumentFragment CreateDocumentFragment()
Creates an T:System.Xml.XmlDocumentFragment.
Represents an XML document. You can use this class to load, validate, edit, add, and position XML in ...
virtual void Load(string filename)
Loads the XML document from the specified URL.
abstract string LocalName
Gets the local name of the node, when overridden in a derived class.
virtual XmlDocumentType DocumentType
Gets the node containing the DOCTYPE declaration.
Represents the XML declaration node <?xml version='1.0'...?>.
override void WriteContentTo(XmlWriter xw)
Saves all the children of the XmlDocument node to the specified T:System.Xml.XmlWriter.
IEnumerator GetEnumerator()
Get an enumerator that iterates through the child nodes in the current node.
virtual void Save(string filename)
Saves the XML document to the specified file. If the specified file exists, this method overwrites it...
XmlNodeChangedEventHandler NodeChanging
Occurs when the P:System.Xml.XmlNode.Value of a node belonging to this document is about to be change...
Defines the post-schema-validation infoset of a validated XML node.
virtual void Add(object key, object value)
Adds an element with the specified key and value into the T:System.Collections.Hashtable.
bool MoveNext()
Advances the enumerator to the next element of the collection.
Represents a CDATA section.
virtual XmlNode ParentNode
Gets the parent of this node (for nodes that can have parents).
Represents an ordered collection of nodes.
XmlNameTable NameTable
Gets the T:System.Xml.XmlNameTable associated with this implementation.
override string BaseURI
Gets the base URI of the current node.
virtual void Save(Stream outStream)
Saves the XML document to the specified stream.
Represents white space in element content.
virtual void Load(Stream inStream)
Loads the XML document from the specified stream.
void Demand()
Forces a T:System.Security.SecurityException at run time if all callers higher in the call stack have...
abstract void WriteStartDocument()
When overridden in a derived class, writes the XML declaration with the version "1....
abstract void WriteTo(XmlWriter w)
Saves the current node to the specified T:System.Xml.XmlWriter, when overridden in a derived class.
virtual XmlElement GetElementById(string elementId)
Gets the T:System.Xml.XmlElement with the specified ID.
virtual void LoadXml(string xml)
Loads the XML document from the specified string.
XmlElement CreateElement(string name)
Creates an element with the specified name.
Provides a mechanism for releasing unmanaged resources.To browse the .NET Framework source code for t...
virtual XmlNode LastChild
Gets the last child of the node.
virtual void Load(XmlReader reader)
Loads the XML document from the specified T:System.Xml.XmlReader.
virtual int Count
Gets the number of elements actually contained in the T:System.Collections.ArrayList.
override XPathNavigator CreateNavigator()
Creates a new T:System.Xml.XPath.XPathNavigator object for navigating this document.
virtual XmlNode ReadNode(XmlReader reader)
Creates an T:System.Xml.XmlNode object based on the information in the T:System.Xml....
virtual XmlDeclaration CreateXmlDeclaration(string version, string encoding, string standalone)
Creates an T:System.Xml.XmlDeclaration node with the specified values.
XmlNodeChangedEventHandler NodeRemoving
Occurs when a node belonging to this document is about to be removed from the document.
override string InnerText
Throws an T:System.InvalidOperationException in all cases.
Resolves external XML resources named by a Uniform Resource Identifier (URI).
Represents an attribute. Valid and default values for the attribute are defined in a document type de...
XmlNodeChangedEventHandler NodeChanged
Occurs when the P:System.Xml.XmlNode.Value of a node belonging to this document has been changed.
Represents an entity reference node.
override bool IsReadOnly
Gets a value indicating whether the current node is read-only.
override XmlNode CloneNode(bool deep)
Creates a duplicate of this node.
int Count
Gets the number of logical XML Schema definition language (XSD) schemas in the T:System....
XmlAttribute CreateAttribute(string qualifiedName, string namespaceURI)
Creates an T:System.Xml.XmlAttribute with the specified qualified name and P:System....
XmlNodeType
Specifies the type of node.
Represents a processing instruction, which XML defines to keep processor-specific information in the ...
virtual XmlNodeList GetElementsByTagName(string name)
Returns an T:System.Xml.XmlNodeList containing a list of all descendant elements that match the speci...
EntityHandling
Specifies how the T:System.Xml.XmlTextReader or T:System.Xml.XmlValidatingReader handle entities.
Represents the document type declaration.
static Delegate Remove(Delegate source, Delegate value)
Removes the last occurrence of the invocation list of a delegate from the invocation list of another ...
static Delegate Combine(Delegate a, Delegate b)
Concatenates the invocation lists of two delegates.
XmlDocument()
Initializes a new instance of the T:System.Xml.XmlDocument class.
XPathNodeType
Defines the XPath node types that can be returned from the T:System.Xml.XPath.XPathNavigator class.
static Encoding GetEncoding(int codepage)
Returns the encoding associated with the specified code page identifier.
virtual string NamespaceURI
Gets the namespace URI of this node.
virtual void Save(XmlWriter w)
Saves the XML document to the specified T:System.Xml.XmlWriter.
virtual bool HasChildNodes
Gets a value indicating whether this node has any child nodes.
Defines the context for a set of T:System.Xml.XmlDocument objects.
XmlSchemaValidity Validity
Gets the T:System.Xml.Schema.XmlSchemaValidity value of this validated XML node.
Represents a writer that provides a fast, non-cached, forward-only way to generate streams or files t...
XmlNodeChangedEventHandler NodeRemoved
Occurs when a node belonging to this document has been removed from its parent.
Represents a weak reference, which references an object while still allowing that object to be reclai...
Represents a reader that provides fast, non-cached, forward-only access to XML data....
Represents a collection of nodes that can be accessed by name or index.
Defines a permission set that has a name and description associated with it. This class cannot be inh...
Provides data for the E:System.Xml.XmlDocument.NodeChanged, E:System.Xml.XmlDocument....
void Validate(ValidationEventHandler validationEventHandler, XmlNode nodeToValidate)
Validates the T:System.Xml.XmlNode object specified against the XML Schema Definition Language (XSD) ...
Represents a reader that provides fast, noncached, forward-only access to XML data....
virtual XmlComment CreateComment(string data)
Creates an T:System.Xml.XmlComment containing the specified data.
override void WriteTo(XmlWriter w)
Saves the XmlDocument node to the specified T:System.Xml.XmlWriter.
virtual XmlText CreateTextNode(string text)
Creates an T:System.Xml.XmlText with the specified text.
virtual XmlNode ImportNode(XmlNode node, bool deep)
Imports a node from another document to the current document.
XmlElement DocumentElement
Gets the root T:System.Xml.XmlElement for the document.
override IXmlSchemaInfo SchemaInfo
Returns the Post-Schema-Validation-Infoset (PSVI) of the node.
string? Encoding
Gets or sets the encoding level of the XML document.
abstract void Flush()
When overridden in a derived class, flushes whatever is in the buffer to the underlying streams and a...
SecurityAction
Specifies the security actions that can be performed using declarative security.
Implements a single-threaded T:System.Xml.XmlNameTable.
virtual void Save(TextWriter writer)
Saves the XML document to the specified T:System.IO.TextWriter.
Represents a collection that can contain many different types of permissions.
virtual XmlAttribute CreateAttribute(string prefix, string localName, string namespaceURI)
Creates an T:System.Xml.XmlAttribute with the specified P:System.Xml.XmlNode.Prefix,...
Represents the post-schema-validation infoset of a validated XML node.
bool PreserveWhitespace
Gets or sets a value indicating whether to preserve white space in element content.
virtual XmlDocumentType CreateDocumentType(string name, string publicId, string systemId, string internalSubset)
Returns a new T:System.Xml.XmlDocumentType object.
virtual XmlNodeList GetElementsByTagName(string localName, string namespaceURI)
Returns an T:System.Xml.XmlNodeList containing a list of all descendant elements that match the speci...
XmlSchemaValidity
Represents the validity of an XML item validated by the T:System.Xml.Schema.XmlSchemaValidator class.
virtual XmlWhitespace CreateWhitespace(string text)
Creates an T:System.Xml.XmlWhitespace node.
Version(int major, int minor, int build, int revision)
Initializes a new instance of the T:System.Version class with the specified major,...
Gets the node immediately preceding or following this node.
XmlNodeChangedAction
Specifies the type of node change.
Represents a collection of key/value pairs that are organized based on the hash code of the key....
virtual XmlNode GetNamedItem(string name)
Retrieves an T:System.Xml.XmlNode specified by name.
virtual XmlElement CreateElement(string prefix, string localName, string namespaceURI)
Creates an element with the specified P:System.Xml.XmlNode.Prefix, P:System.Xml.XmlDocument....
Represents a writer that can write a sequential series of characters. This class is abstract.
virtual string Value
Gets or sets the value of the node.
object Current
Gets the element in the collection at the current position of the enumerator.
Represents a delegate, which is a data structure that refers to a static method or to a class instanc...
Represents the version number of an assembly, operating system, or the common language runtime....
XmlAttribute CreateAttribute(string name)
Creates an T:System.Xml.XmlAttribute with the specified P:System.Xml.XmlDocument.Name.
internal XmlDocument(XmlImplementation imp)
Initializes a new instance of the XmlDocument class with the specified T:System.Xml....
override void Close()
Changes the P:System.Xml.XmlReader.ReadState to Closed.
Table of atomized string objects.
XmlDocument(XmlNameTable nt)
Initializes a new instance of the XmlDocument class with the specified T:System.Xml....
Represents the text content of an element or attribute.
virtual XmlProcessingInstruction CreateProcessingInstruction(string target, string data)
Creates an T:System.Xml.XmlProcessingInstruction with the specified name and data.
override IXmlSchemaInfo SchemaInfo
Gets the post schema validation infoset that has been assigned to this node as a result of schema val...
override XmlDocument OwnerDocument
Gets the T:System.Xml.XmlDocument to which the current node belongs.
virtual string Prefix
Gets or sets the namespace prefix of this node.
XmlNodeChangedEventHandler NodeInserted
Occurs when a node belonging to this document has been inserted into another node.
virtual int Add(object value)
Adds an object to the end of the T:System.Collections.ArrayList.
Returns detailed information about the last exception.
XmlElement CreateElement(string qualifiedName, string namespaceURI)
Creates an T:System.Xml.XmlElement with the qualified name and P:System.Xml.XmlNode....
virtual XmlNode CreateNode(string nodeTypeString, string name, string namespaceURI)
Creates an T:System.Xml.XmlNode with the specified node type, P:System.Xml.XmlDocument....
The exception that is thrown when one of the arguments provided to a method is not valid.
virtual XmlSignificantWhitespace CreateSignificantWhitespace(string text)
Creates an T:System.Xml.XmlSignificantWhitespace node.
virtual internal XmlAttribute CreateDefaultAttribute(string prefix, string localName, string namespaceURI)
Creates a default attribute with the specified prefix, local name and namespace URI.
void Validate(ValidationEventHandler validationEventHandler)
Validates the T:System.Xml.XmlDocument against the XML Schema Definition Language (XSD) schemas conta...
virtual XmlAttribute SetAttributeNode(XmlAttribute newAttr)
Adds the specified T:System.Xml.XmlAttribute.
virtual void Load(TextReader txtReader)
Loads the XML document from the specified T:System.IO.TextReader.
virtual void Remove(object obj)
Removes the first occurrence of a specific object from the T:System.Collections.ArrayList.
virtual bool Contains(object key)
Determines whether the T:System.Collections.Hashtable contains a specific key.
abstract string Add(char[] array, int offset, int length)
When overridden in a derived class, atomizes the specified string and adds it to the XmlNameTable.
virtual XmlNode CreateNode(XmlNodeType type, string name, string namespaceURI)
Creates an T:System.Xml.XmlNode with the specified T:System.Xml.XmlNodeType, P:System....
virtual XmlEntityReference CreateEntityReference(string name)
Creates an T:System.Xml.XmlEntityReference with the specified name.
virtual void Remove(object key)
Removes the element with the specified key from the T:System.Collections.Hashtable.
virtual XmlNode CreateNode(XmlNodeType type, string prefix, string name, string namespaceURI)
Creates a T:System.Xml.XmlNode with the specified T:System.Xml.XmlNodeType, P:System....
Represents a reader that can read a sequential series of characters.
object Value
Gets the value of the current dictionary entry.
virtual XmlNode FirstChild
Gets the first child of the node.
XmlNamedNodeMap Entities
Gets the collection of T:System.Xml.XmlEntity nodes declared in the document type declaration.
Provides a cursor model for navigating and editing XML data.
override string LocalName
Gets the local name of the node.
Enumerates the elements of a nongeneric dictionary.
override XmlNodeType NodeType
Gets the type of the current node.
Formatting
Specifies formatting options for the T:System.Xml.XmlTextWriter.
The exception that is thrown when a method call is invalid for the object's current state.
override string InnerXml
Gets or sets the markup representing the children of the current node.
virtual XmlNode NextSibling
Gets the node immediately following this node.
Encoding()
Initializes a new instance of the T:System.Text.Encoding class.
virtual void RemoveAll()
Removes all the child nodes and/or attributes of the current node.
Provides information about a specific culture (called a locale for unmanaged code development)....
override string Name
Gets the qualified name of the node.
override XmlNode ParentNode
Gets the parent node of this node (for nodes that can have parents).
override string Value
Gets or sets the value of the node.
XmlImplementation Implementation
Gets the T:System.Xml.XmlImplementation object for the current document.
virtual XmlCDataSection CreateCDataSection(string data)
Creates an T:System.Xml.XmlCDataSection containing the specified data.
void Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resourc...
XmlSchemaSet Schemas
Gets or sets the T:System.Xml.Schema.XmlSchemaSet object associated with this T:System....
Implements a T:System.IO.TextReader that reads from a string.
abstract WriteState WriteState
When overridden in a derived class, gets the state of the writer.
The exception that is thrown when a security error is detected.
Represents a single node in the XML document.
abstract string Name
Gets the qualified name of the node, when overridden in a derived class.
Supports a simple iteration over a non-generic collection.
abstract XmlNodeType NodeType
Gets the type of the current node, when overridden in a derived class.
Represents a lightweight object that is useful for tree insert operations.
virtual XmlDocument CreateDocument()
Creates a new T:System.Xml.XmlDocument.
Implements the T:System.Collections.IList interface using an array whose size is dynamically increase...
XmlNodeChangedEventHandler NodeInserting
Occurs when a node belonging to this document is about to be inserted into another node.
virtual internal XPathNavigator CreateNavigator(XmlNode node)
Creates an T:System.Xml.XPath.XPathNavigator object for navigating this document positioned on the T:...
Contains a cache of XML Schema definition language (XSD) schemas.
Represents white space between markup in a mixed content node or white space within an xml:space= 'pr...
Provides a generic view of a sequence of bytes. This is an abstract class.To browse the ....