System.Xml
[00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00]
1.0.5000.0
2.0.0.0
4.0.0.0
To be added
System.Xml.XmlNode
System.Xml.IHasXmlChildNode
This class implements the W3C Document Object Model (DOM) Level 1 Core and the Core DOM Level 2. The DOM is an in-memory (cache) tree representation of an XML document and enables the navigation and editing of this document. Because XmlDocument implements the interface it can also be used as the source document for the class.
The class extends XmlDocument and allows structured data to be stored, retrieved, and manipulated through a relational . This class allows components to mix XML and relational views of the underlying data.
For more information, see [<topic://cpconXMLDocumentObjectModelDOM>].
Exceptions raised as a result of using the class, such as the class may contain sensitive information that should not be exposed in untrusted scenarios. Exceptions should be properly handled so that this sensitive information is not exposed in untrusted scenarios.
Represents an XML document.
Constructor
1.0.5000.0
2.0.0.0
4.0.0.0
Creates a new document object. It is equivalent to with a new object as its argument.
Initializes a new instance of the class.
Constructor
1.0.5000.0
2.0.0.0
4.0.0.0
To be added.
Initializes a new instance of the XmlDocument class with the specified .
The XmlImplementation to use.
Constructor
1.0.5000.0
2.0.0.0
4.0.0.0
Creates a new document object, using argument as its property.
The XmlNameTable is added some name strings used in the document object model, such as "#element" (node names), "xml", "lang" and "space" (predefined xml attributes).
Initializes a new instance of the XmlDocument class with the specified .
The XmlNameTable to use.
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.String
To be added.
A networked XML document is comprised of chunks of data aggregated using various W3C standard inclusion mechanisms and therefore contains nodes that come from different places. The BaseURI tells you where these nodes came from.
For Document nodes, BaseURI returns the location of the XML document. For example, if the XmlDocument was loaded using the following call doc.Load("http://server/mydata.xml"), the BaseURI for the document node is http://server/mydata.xml. However, if the method is redirected by server to a different URI, BaseURI returns the original URI passed to the Load method.
This property is a Microsoft extension to the Document Object Model (DOM). For additional information on BaseURI and how it behaves with other node types, see .
Gets the base URI of the current node.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlNode
This method serves as a copy constructor for nodes. The cloned node has no parent ( returns null).
If is true, the cloned node includes all the child nodes, otherwise only the XmlDocument node is cloned. See the method to see how this method behaves on other node types.
Creates a duplicate of this node.
The cloned XmlDocument node.
true to recursively clone the subtree under the specified node; false to clone only the node itself.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlAttribute
The XmlAttribute can be added to an using the method.
Creates an with the specified .
The new XmlAttribute.
The qualified name of the attribute. If the name contains a colon, the property reflects the part of the name preceding the first colon and the property reflects the part of the name following the first colon. The remains empty unless the prefix is a recognized built-in prefix such as xmlns. In this case NamespaceURI has a value of http://www.w3.org/2000/xmlns/.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlAttribute
The XmlAttribute can be added to an using the method.
Creates an with the specified qualified name and .
The new XmlAttribute.
The qualified name of the attribute. If the name contains a colon then the property will reflect the part of the name preceding the colon and the property will reflect the part of the name after the colon.
The namespaceURI of the attribute. If the qualified name includes a prefix of xmlns, then this parameter must be http://www.w3.org/2000/xmlns/.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlAttribute
The XmlAttribute can be added to an using the method.
This method is a Microsoft extension to the Document Object Model (DOM).
Creates an with the specified , , and .
The new XmlAttribute.
The prefix of the attribute (if any). String.Empty and null are equivalent.
The local name of the attribute.
The namespace URI of the attribute (if any). String.Empty and null are equivalent. If is xmlns, then this parameter must be http://www.w3.org/2000/xmlns/; otherwise an exception is thrown.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlCDataSection
Although this method creates the new object in the context of the document, it does not automatically add the new object to the document tree. To add the new object, you must explicitly call one of the node insert methods.
According to the W3C Extensible Markup Language (XML) 1.0 recommendation (www.w3.org/TR/1998/REC-xml-19980210), CDataSection nodes are allowed within Element nodes and in EntityReference nodes when the EntityReference node is not a child of an Attribute node.
Creates an containing the specified data.
The new XmlCDataSection.
The content of the new XmlCDataSection.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlComment
Although this method creates the new object in the context of the document, it does not automatically add the new object to the document tree. To add the new object, you must explicitly call one of the node insert methods.
According to the W3C Extensible Markup Language (XML) 1.0 recommendation (www.w3.org/TR/1998/REC-xml-19980210), Comment nodes are only allowed within Document, Element and EntityReference nodes, when the EntityReference node is not a child of an Attribute node.
Creates an containing the specified data.
The new XmlComment.
The content of the new XmlComment.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlAttribute
This method is a Microsoft extension to the Document Object Model (DOM).
Creates a default attribute with the specified prefix, local name and namespace URI.
The new .
The prefix of the attribute (if any).
The local name of the attribute.
The namespace URI of the attribute (if any).
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlDocumentFragment
DocumentFragment nodes cannot be inserted into a document. However, you can insert children of the DocumentFragment node into a document.
Creates an .
The new XmlDocumentFragment.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlDocumentType
The returned node will have parsed and collections.
Although this method creates the new object in the context of the document, it does not automatically add the new object to the document tree. To add the new object, you must explicitly call one of the node insert methods.
According to the W3C Extensible Markup Language (XML) 1.0 recommendation (www.w3.org/TR/1998/REC-xml-19980210), DocumentType nodes are only allowed within Document nodes. Each can have only one DocumentType node. The DocumentType node must also be inserted before the root element of the XmlDocument (if the document already has a root element, you cannot add a DocumentType node).
If the passed parameters do not combine to build a valid XmlDocumentType, an exception is thrown.
Returns a new object.
The new XmlDocumentType.
Name of the document type.
The public identifier of the document type or null. You can specify a public URI and also a system identifier to identify the location of the external DTD subset.
The system identifier of the document type or null. Specifies the URL of the file location for the external DTD subset.
The DTD internal subset of the document type or null.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlElement
Note that the instance returned implements the XmlElement interface, so default attributes would be created directly on the returned object.
Although this method creates the new object in the context of the document, it does not automatically add the new object to the document tree. To add the new object, you must explicitly call one of the node insert methods.
According to the W3C Extensible Markup Language (XML) 1.0 recommendation (www.w3.org/TR/1998/REC-xml-19980210), Element nodes are allowed within Document and Element nodes, and in EntityReference nodes when the EntityReference node is not a child of an Attribute node.
Creates an element with the specified name.
The new XmlElement.
The qualified name of the element. If the name contains a colon then the property reflects the part of the name preceding the colon and the property reflects the part of the name after the colon. The qualified name cannot include a prefix of'xmlns'.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlElement
The following C# code
XmlElement elem;
elem=doc.CreateElement("xy:item", "urn:abc");
results in an element that is equivalent to the following XML text.
<xy:item
xmlns:xy="urn:abc"/>
Although this method creates the new object in the context of the document, it does not automatically add the new object to the document tree. To add the new object, you must explicitly call one of the node insert methods.
According to the W3C Extensible Markup Language (XML) 1.0 recommendation (www.w3.org/TR/1998/REC-xml-19980210), Element nodes are allowed within Document and Element nodes, and in EntityReference nodes when the EntityReference node is not a child of an Attribute node.
Creates an with the qualified name and .
The new XmlElement.
The qualified name of the element. If the name contains a colon then the property will reflect the part of the name preceding the colon and the property will reflect the part of the name after the colon. The qualified name cannot include a prefix of'xmlns'.
The namespace URI of the element.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlElement
The following C# code
XmlElement elem;
elem=doc.CreateElement("xy", "item", "urn:abc");
creates an element equivalent to the following XML text:
<xy:item xmlns:xy="urn:abc"/>
Although this method creates the new object in the context of the document, it does not automatically add the new object to the document tree. To add the new object, you must explicitly call one of the node insert methods.
According to the W3C Extensible Markup Language (XML) 1.0 recommendation (www.w3.org/TR/1998/REC-xml-19980210), Element nodes are allowed within Document and Element nodes, and in EntityReference nodes when the EntityReference is outside an Attribute node.
This method is a Microsoft extension to the Document Object Model (DOM).
Creates an element with the specified , , and .
The new .
The prefix of the new element (if any). String.Empty and null are equivalent.
The local name of the new element.
The namespace URI of the new element (if any). String.Empty and null are equivalent.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlEntityReference
If the referenced entity is known, the child list of the XmlEntityReference node is made the same as that of the corresponding node.
The namespaces used in the replacement text for the entity reference are bound at the time the parent of the entity reference node is first set (for example, when the entity reference node is inserted into the document). For example, given the following entity:
<!ENTITY a "<b>test</b>">
If you call CreateEntityReference("a") you get back a single node of type EntityReference with no children. If you append this node as a child of the following node,
<item xmlns="urn:1"/>
then, at the time of calling , the parent of the newly created entity reference node is set and the children are expanded in this namespace context. The child element node b will have NamespaceURI equal to urn:1. The child nodes of the entity reference remain the same even if you move the entity reference to a place in the document that has a different default namespace context. This does not happen for existing entity reference nodes when you remove and insert them or for entity references that you clone with . It only happens for newly created entity references.
If the corresponding entity is not defined in the DocumentType when the entity reference node is added, because the entity reference is not defined, its only child node will be an empty text node.
The built-in entities amp, lt, gt, apos, and quot are also allowed, and they will have a child text node with the appropriate expanded character value.
Although this method creates the new object in the context of the document, it does not automatically add the new object to the document tree. To add the new object, you must explicitly call one of the node insert methods.
According to the W3C Extensible Markup Language (XML) 1.0 recommendation (www.w3.org/TR/1998/REC-xml-19980210), EntityReference nodes are only allowed within Element, Attribute and EntityReference nodes.
Creates an with the specified name.
The new XmlEntityReference.
The name of the entity reference.
Method
2.0.0.0
4.0.0.0
System.Xml.XPath.XPathNavigator
This method is a Microsoft extension to the Document Object Model (DOM).
Creates a new object for navigating this document.
An object.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XPath.XPathNavigator
This method is a Microsoft extension to the Document Object Model (DOM).
Creates an object for navigating this document positioned on the specified.
An object.
The you want the navigator initially positioned on.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlNode
The parameter is case sensitive and must be one of the values in the following table.
-
nodeTypeString
XmlNodeType
-
attribute
Attribute
-
cdatasection
CDATA
-
comment
Comment
-
document
Document
-
documentfragment
DocumentFragment
-
documenttype
DocumentType
-
element
Element
-
entityreference
EntityReference
-
processinginstruction
ProcessingInstruction
-
significantwhitespace
SignificantWhitespace
-
text
Text
-
whitespace
Whitespace
Although this method creates the new object in the context of the document, it does not automatically add the new object to the document tree. To add the new object, you must explicitly call one of the node insert methods.
The following table shows you what NodeType[row] is allowed inside another NodeType[column] according to the W3C Extensible Markup Language (XML) 1.0 recommendation (www.w3.org/TR/1998/REC-xml-19980210).
-
Document
DocumentType
XmlDeclaration
Element
Attribute
Text
CDATA
Markup
EntityReference
-
Document
no
no
no
no
no
no
no
no
no
-
DocumentType
yes
no
no
no
no
no
no
no
no
-
XmlDeclaration
yes*
no
no
no
no
no
no
no
no
-
Element
yes
no
no
yes
no
no
no
no
yes***
-
Attribute
no
no
no
yes****
no
no
no
no
no
-
Text
no
no
no
yes
yes
no
no
no
yes
-
CDATA
no
no
no
yes
no
no
no
no
yes***
-
Markup**
yes
no
no
yes
no
no
no
no
no
-
EntityReference
no
no
no
yes
yes
no
no
no
yes
* The XmlDeclaration node must be the first child of the Document node.
** Markup includes ProcessingInstruction and Comment nodes.
*** Element and CDATA nodes are only allowed in EntityReference nodes when the EntityReference node is not a child of an Attribute node.
**** Attributes are not children of an Element node. Attributes are contained inside an attribute collection that belongs to an Element node.
This method is a Microsoft extension to the Document Object Model (DOM).
Creates an with the specified node type, , and .
The new XmlNode.
String version of the of the new node. This parameter must be one of the values listed in the table below.
The qualified name of the new node. If the name contains a colon, it is parsed into and components.
The namespace URI of the new node.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlNode
Although this method creates the new object in the context of the document, it does not automatically add the new object to the document tree. To add the new object, you must explicitly call one of the node insert methods.
The following table shows you what NodeType[row] is allowed inside another NodeType[column] according to the W3C Extensible Markup Language (XML) 1.0 recommendation (www.w3.org/TR/1998/REC-xml-19980210).
-
Document
DocumentType
XmlDeclaration
Element
Attribute
Text
CDATA
Markup
EntityReference
-
Document
no
no
no
no
no
no
no
no
no
-
DocumentType
yes
no
no
no
no
no
no
no
no
-
XmlDeclaration
yes*
no
no
no
no
no
no
no
no
-
Element
yes
no
no
yes
no
no
no
no
yes***
-
Attribute
no
no
no
yes****
no
no
no
no
no
-
Text
no
no
no
yes
yes
no
no
no
yes
-
CDATA
no
no
no
yes
no
no
no
no
yes***
-
Markup**
yes
no
no
yes
no
no
no
no
no
-
EntityReference
no
no
no
yes
yes
no
no
no
yes
* The XmlDeclaration node must be the first child of the Document node.
** Markup includes ProcessingInstruction and Comment nodes.
*** Element and CDATA nodes are only allowed in EntityReference nodes when the EntityReference node is not a child of an Attribute node.
**** Attributes are not children of an Element node. Attributes are contained inside an attribute collection that belongs to an Element node.
This method is a Microsoft extension to the Document Object Model (DOM).
Creates an with the specified , , and .
The new XmlNode.
The XmlNodeType of the new node.
The qualified name of the new node. If the name contains a colon then it is parsed into and components.
The namespace URI of the new node.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlNode
Although this method creates the new object in the context of the document, it does not automatically add the new object to the document tree. To add the new object, you must explicitly call one of the node insert methods.
The following table shows you what NodeType[row] is allowed inside another NodeType[column] according to the W3C Extensible Markup Language (XML) 1.0 recommendation (www.w3.org/TR/1998/REC-xml-19980210).
-
Document
DocumentType
XmlDeclaration
Element
Attribute
Text
CDATA
Markup
EntityReference
-
Document
no
no
no
no
no
no
no
no
no
-
DocumentType
yes
no
no
no
no
no
no
no
no
-
XmlDeclaration
yes*
no
no
no
no
no
no
no
no
-
Element
yes
no
no
yes
no
no
no
no
yes***
-
Attribute
no
no
no
yes****
no
no
no
no
no
-
Text
no
no
no
yes
yes
no
no
no
yes
-
CDATA
no
no
no
yes
no
no
no
no
yes***
-
Markup**
yes
no
no
yes
no
no
no
no
no
-
EntityReference
no
no
no
yes
yes
no
no
no
yes
* The XmlDeclaration node must be the first child of the Document node.
** Markup includes ProcessingInstruction and Comment nodes.
*** Element and CDATA nodes are only allowed in EntityReference nodes when the EntityReference node is not a child of an Attribute node.
**** Attributes are not children of an Element node. Attributes are contained inside an attribute collection that belongs to the Element node.
This method is a Microsoft extension to the Document Object Model (DOM).
Creates a with the specified , , , and .
The new XmlNode.
The XmlNodeType of the new node.
The prefix of the new node.
The local name of the new node.
The namespace URI of the new node.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlProcessingInstruction
Although this method creates the new object in the context of the document, it does not automatically add the new object to the document tree. To add the new object, you must explicitly call one of the node insert methods.
According to the W3C Extensible Markup Language (XML) 1.0 recommendation (www.w3.org/TR/1998/REC-xml-19980210), ProcessingInstruction nodes are only allowed within Document, Element, and EntityReference nodes, when the EntityReference node is not a child of an Attribute node.
Creates an with the specified name and data.
The new XmlProcessingInstruction.
The name of the processing instruction.
The data for the processing instruction.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlSignificantWhitespace
This method is a Microsoft extension to the Document Object Model (DOM). It is used when you want to manually format your document.
Although this method creates the new object in the context of the document, it does not automatically add the new object to the document tree. To add the new object, you must explicitly call one of the node insert methods.
Creates an node.
A new XmlSignificantWhitespace node.
The string must contain only the following characters  and 	
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlText
Although this method creates the new object in the context of the document, it does not automatically add the new object to the document tree. To add the new object, you must explicitly call one of the node insert methods.
According to the W3C Extensible Markup Language (XML) 1.0 recommendation (www.w3.org/TR/1998/REC-xml-19980210), Text nodes are only allowed within Element, Attribute and EntityReference nodes.
Creates an with the specified text.
The new XmlText node.
The text for the Text node.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlWhitespace
This method is a Microsoft extension to the Document Object Model (DOM). It is used when you want to manually format your document.
Although this method creates the new object in the context of the document, it does not automatically add the new object to the document tree. To add the new object, you must explicitly call one of the node insert methods.
Creates an node.
A new XmlWhitespace node.
The string must contain only the following characters  and 	
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlDeclaration
The attributes are exposed as special properties on the XmlDeclaration node, and not as nodes.
Although this method creates the new object in the context of the document, it does not automatically add the new object to the document tree. To add the new object, you must explicitly call one of the node insert methods.
According to the W3C Extensible Markup Language (XML) 1.0 recommendation (www.w3.org/TR/1998/REC-xml-19980210), the XmlDeclaration node must be the first node in the document.
This method is a Microsoft extension to the Document Object Model (DOM).
Creates an node with the specified values.
The new XmlDeclaration node.
The version must be "1.0".
The value of the encoding attribute. This is the encoding that is used when you save the to a file or a stream; therefore, it must be set to a string supported by the class, otherwise fails. If this is null or String.Empty, the Save method does not write an encoding attribute on the XML declaration and therefore the default encoding, UTF-8, is used.
The value must be either "yes" or "no". If this is null or String.Empty, the Save method does not write a standalone attribute on the XML declaration.
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlElement
an object that represents the document element, or null if it does not exist yet.
It represents the document element (root element) of this document. A well-formed XML document must have exactly one element, but this property could be null.
This property is an equivalent of "documentElement" attribute of Document interface in W3C Document Object Model Core specification.
Gets the root for the document.
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlDocumentType
object that represents the document type definition (DTD) of this document, or null if none as such.
An XmlDocument can have one and only one child with equal to DocumentType.
This property is read-only. To change the DocumentType node, delete the existing node, create a new one using the method, and add the new node to the document.
Gets the node containing the DOCTYPE declaration.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlElement
If the document has multiple elements with the matching ID, this method returns the first matching element in the document.
The DOM implementation must have information which defines which attributes are of type ID. Although attributes of type ID can be defined in either XSD schemas or DTDs, this version of the product only supports those defined in DTDs. Attributes with the name "ID" are not of type ID unless so defined in the DTD. Implementations where it is unknown whether the attributes are of type ID are expected to return null.
Gets the with the specified ID.
The XmlElement with the matching ID or null if no matching element is found.
The attribute ID to match.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlNodeList
The nodes are placed in the order in which they would be encountered in the document.
It is recommended that you use the or method instead of the method.
Returns an containing a list of all descendant elements that match the specified .
An containing a list of all matching nodes. If no nodes match , the returned collection will be empty.
The qualified name to match. It is matched against the Name property of the matching node. The special value "*" matches all tags.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlNodeList
The nodes are placed in the order in which they would be encountered in the document tree.
It is recommended that you use the or method instead of the method.
Returns an containing a list of all descendant elements that match the specified and .
An containing a list of all matching nodes. If no nodes match the specified and , the returned collection will be empty.
The LocalName to match. The special value "*" matches all tags.
NamespaceURI to match.
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlImplementation
object which created this object, or null if there is no such relevant object.
XmlDocument objects created from the same XmlImplementation share the same . This allows users to compare attribute and element names as objects rather than strings.
Although the XmlDocument objects share the same implementation, to move nodes from one document to another you must use the method.
Gets the object for the current document.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlNode
The returned node has no parent. The source node is not altered or removed from the original document; ImportNode creates a copy of the source node.
Importing a node creates an XmlNode object owned by the importing document, with and identical to the source node. The new object also has the attributes related to namespaces (, , and ).
Depending on the node type of the imported node and the value of the parameter, additional information is copied as appropriate. This method attempts to mirror the behavior expected if a fragment of XML or HTML source was copied from one document to another (recognizing that, in the XML case, the two documents could have different DTDs).
The following table describes the specific behavior for each .
-
XmlNodeType
ImportNode(true)
ImportNode(false)
-
Attribute
The property is set to true on the generated . The descendants of the source XmlAttribute are recursively imported and the resulting nodes reassembled to form the corresponding subtree.
The parameter does not apply to XmlAttribute nodes; they always carry their children with them when imported.
-
CData
Copies the node, including its data.
Copies the node, including its data.
-
Comment
Copies the node, including its data.
Copies the node, including its data.
-
DocumentFragment
The descendants of the source node are recursively imported and the resulting nodes reassembled to form the corresponding subtree.
An empty is generated.
-
DocumentType
Copies the node, including its data.*
Copies the node, including its data.*
-
Element
The descendants of the source element and its specified attribute nodes are recursively imported and the resulting nodes reassembled to form the corresponding subtree.
Note: Default attributes are not copied. If the document being imported into defines default attributes for this element name, those are assigned.
Specified attribute nodes of the source element are imported, and the generated XmlAttribute nodes are attached to the generated .
Note: Default attributes are not copied. If the document being imported into defines default attributes for this element name, those are assigned.
-
EntityReference
Because the source and destination documents could have the entities defined differently, this method only copies the node. The replacement text is not included. If the destination document has the entity defined, its value is assigned.
Because the source and destination documents could have the entities defined differently, this method only copies the node. The replacement text is not included. If the destination document has the entity defined, its value is assigned.
-
ProcessingInstruction
Copies the target and data value from the imported node.
Copies the target and data value from the imported node.
-
Text
Copies the node, including its data.
Copies the node, including its data.
-
SignificantWhitespace
Copies the node, including its data.
Copies the node, including its data.
-
Whitespace
Copies the node, including its data.
Copies the node, including its data.
-
XmlDeclaration
Copies the target and data value from the imported node.
Copies the target and data value from the imported node.
-
All other node types.
These node types cannot be imported.
These node types cannot be imported.
*Although DocumentType nodes can be imported, a document can only have one DocumentType. If the document currently has a DocumenType node, it must be removed before adding a new one.
Imports a node from another document to the current document.
The imported .
The node being imported.
true to perform a deep clone; otherwise, false.
Property
4.0.0.0
System.String
To be added.
This property is not implemented.
Throws an in all cases.
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.String
To be added.
Setting this property replaces the children of the node with the parsed contents of the given string. The parsing is done in the current namespace context.
InnerXml removes redundant namespace declarations. As a result, numerous cut and paste operations do not increase the size of your document with redundant namespace declarations. Consider the following XSL document:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="stock">
...
</xsl:template>
</xsl:stylesheet>
The InnerXml property on the stylesheet node returns the following string:
<xsl:template match="stock"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
...
</xsl:template>
Notice the additional xmlns:xsl namespace declaration which is used to preserve the node identity. If you re-insert this inner XML string, you will get back your original document. In other words, InnerXml recognizes that the xmlns:xsl namespace declaration is redundant, given that the parent xsl:stylesheet element already has the xmlns:xsl namespace delcaration, and therefore removes it.
If you move InnerXml from a document with no default namespace to a document with a default namespace, the behavior is a little different. Consider the following XML string:
<test>
<item>123</item>
</test>
InnerXml returns a plain XML string with no namespace declarations:
<item>123</item>
If you then insert this string into a document that does have a default namespace, such as the following:
<test2 xmlns="urn:1">
</test>
InnerXml parses the string in context, and the new nodes pick up the urn:1 namespace. The result looks like this:
<test2 xmlns="urn:1">
<item>123</item>
</test>
Now when you ask for the InnerXml you get back the following:
<item xmlns="urn:1">123</item>
If you explicitly want the inserted item to preserve the fact that it came from a document that had no namespace then you need to manually add an xmlns= "" declaration and insert the resulting string:
<item xmlns="">123</item>
The net effect of all this is as follows:
-
Cutting and pasting InnerXml among documents that do not use namespaces is clean and simple and does not create "xmlns" redundancy in your strings.
-
InnerXml can also be used to cut and paste between documents which have more than one namespace (that is XSL stylesheets).
-
xmlns:xsl declarations automatically appear in your strings and disappear in your node hierarchies.
-
In the case where you are moving InnerXml from a document that has no default namespace to a document that does have a default namespace, the new nodes will pick up the new default namespace.
If InnerXml is set with text containing entity references that are not currently defined in the document, the resulting tree will contain empty EntityReference nodes.
This property is a Microsoft extension to the Document Object Model (DOM).
Gets or sets the markup representing the children of the current node.
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.Boolean
To be added.
A read-only node is one whose properties, attributes, or children cannot be changed. You can remove a read-only node from the tree and insert it somewhere else.
This property is a Microsoft extension to the Document Object Model (DOM).
Gets a value indicating whether the current node is read-only.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Void
The Load method always preserves significant white space. The property determines whether or not insignificant white space, that is white space in element content, is preserved. The default is false; white space in element content is not preserved.
If you want validation to occur, you can create a validating instance by using the class and the method. For more information, see Validating XML Data with XmlReader.
This method is a Microsoft extension to the Document Object Model (DOM).
Loads the XML document from the specified stream.
The stream containing the XML document to load.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Void
The Load method always preserves significant white space. The property determines whether or not insignificant white space, that is white space in element content, is preserved. The default is false; white space in element content is not preserved.
If you want validation to occur, you can create a validating instance by using the class and the method. For more information, see Validating XML Data with XmlReader.
This method is a Microsoft extension to the Document Object Model (DOM).
Loads the XML document from the specified .
The TextReader used to feed the XML data into the document.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Void
The Load method always preserves significant white space. The property determines whether or not insignificant white space, that is white space in element content, is preserved. The default is false; white space in element content is not preserved.
If you want validation to occur, you can create a validating instance by using the class and the method. For more information, see Validating XML Data with XmlReader.
This method is a Microsoft extension to the Document Object Model (DOM).
Loads the XML document from the specified URL.
URL for the file containing the XML document to load. The URL can be either a local file or an HTTP URL (a Web address).
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Void
The Load method always preserves significant white space. The property determines whether or not insignificant white space, that is white space in element content, is preserved. The default is false; white space in element content is not preserved.
If the reader is in the initial state ( =ReadState.Initial), Load consumes the entire contents of the reader and builds the DOM from what it finds.
If the reader is already positioned on some node at depth "n", this method loads that node and all subsequent siblings up to the end tag that closes depth "n". This has the following results.
If the current node and its siblings look like the following:
<!--comment--><element1>one</element1><element2>two</element2>
Load throws an exception because a document cannot have two root level elements. If the current node and its siblings look like the following:
<!--comment--><?process instruction?><!--comment--></endtag>
Load succeeds, but you have an incomplete DOM tree because there is no root level element. Before you save the document, you must add a root level element, otherwise will throw an exception.
If the reader is positioned on a leaf node that is invalid for the root level of a document, for example a white space or attribute node, the reader continues to read until it is positioned on a node that can be used for the root. The document begins loading at this point.
If you want validation to occur, you can create a validating instance by using the class and the method. For more information, see Validating XML Data with XmlReader.
This method is a Microsoft extension to the Document Object Model (DOM).
Loads the XML document from the specified .
The XmlReader used to feed the XML data into the document.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Void
By default the LoadXml method does not preserve white space or significant white space.
This method parses DTDs, but does not do DTD or Schema validation. If you want validation to occur, you can create a validating instance by using the class and the method. For more information, see Validating XML Data with XmlReader.
If you want to load from a , , , or , use the Load method instead of this method.
This method is a Microsoft extension to the Document Object Model (DOM).
Loads the XML document from the specified string.
String containing the XML document to load.
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.String
To be added.
The local name returned depends on the of the node. To see a table describing the local name returned for each of the node types, see the property in the class.
Gets the local name of the node.
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.String
To be added.
The name returned depends on the of the node. To see a table describing the name returned for each of the node types, see the property in the class.
Gets the qualified name of the node.
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlNameTable
an that stores all name strings.
Each XmlDocument object has a object. Element and attribute names are stored in the NameTable as atomized strings. This means that even if a name is referenced in the document multiple times it is stored only once in the NameTable. For example, if the document had multiple elements with the name "Customer", NameTable returns the same object whenever it receives a request for that name. As a result, users can write code using object comparisons on these strings rather than the more expensive string comparisons.
For more information on atomized strings, see .
This method is a Microsoft extension to the Document Object Model (DOM).
Gets the associated with this implementation.
Event
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlNodeChangedEventHandler
This event only applies to nodes that have a value.
All nodes created by this document, whether or not they have been inserted into the document, are included in this event.
Occurs when the of a node belonging to this document has been changed.
Event
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlNodeChangedEventHandler
This event allows the user to do extra checking and, if necessary, throw an exception to stop the operation. If an exception is thrown the XmlDocument returns to its original state. This event only applies to nodes that have a value.
All nodes created by this document, whether or not they have been inserted into the document, are included in this event.
Occurs when the of a node belonging to this document is about to be changed.
Event
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlNodeChangedEventHandler
All nodes created by this document, whether or not they have been inserted into the document, are included in this event.
Occurs when a node belonging to this document has been inserted into another node.
Event
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlNodeChangedEventHandler
This event allows the user to do extra checking and, if necessary, throw an exception to stop the operation. If an exception is thrown the XmlDocument returns to its original state.
All nodes created by this document, whether or not they have been inserted into the document, are included in this event.
Occurs when a node belonging to this document is about to be inserted into another node.
Event
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlNodeChangedEventHandler
All nodes created by this document, whether or not they have been inserted into the document, are included in this event.
Occurs when a node belonging to this document has been removed from its parent.
Event
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlNodeChangedEventHandler
This event allows the user to do extra checking and, if necessary, throw an exception to stop the operation. If an exception is thrown the XmlDocument returns to its original state.
All nodes created by this document, whether or not they have been inserted into the document, are included in this event.
Occurs when a node belonging to this document is about to be removed from the document.
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlNodeType
To be added.
To be added.
Gets the type of the current node.
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlDocument
To be added.
To be added.
Gets the to which the current node belongs.
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlNode
To be added.
To be added.
Gets the parent node of this node (for nodes that can have parents).
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.Boolean
A boolean value that indicates whether this document preserves whitespacenodes when it loads the document content.
This property determines how white space is handled during the load and save process.
If PreserveWhitespace is true before or is called, white space nodes are preserved; otherwise, if this property is false, significant white space is preserved, white space is not.
If PreserveWhitespace is true before is called, white space in the document is preserved in the output; otherwise, if this property is false, XmlDocument auto-indents the output.
This method is a Microsoft extension to the Document Object Model (DOM).
Gets or sets a value indicating whether to preserve white space in element content.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlNode
Reads one XmlNode from the given reader and positions the reader on the next node. This method creates the type of XmlNode matching the on which the reader is currently positioned. (If the reader is in the initial state, ReadNode advances the reader to the first node and then operates on that node.)
If the reader is positioned on the start of an element, ReadNode reads all the attributes and any child nodes, up to and including the end tag of the current node. The XmlNode returned contains the sub-tree representing everything read. The reader is positioned immediately after the end tag.
ReadNode can also read attributes, but in this case it does not advance the reader to the next attribute. This allows you to write the following C# code:
XmlDocument doc = new XmlDocument();
while (reader.MoveToNextAttribute())
{
XmlNode a = doc.ReadNode(reader);
// Do some more processing.
}
ReadNode does consume the attribute value though, which means after calling ReadNode on an attribute, returns false.
Creates an object based on the information in the . The reader must be positioned on a node or attribute.
The new XmlNode or null if no more nodes exist.
The XML source
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Void
White space is preserved only if is set to true.
The XmlDeclaration of the current XmlDocument object determines the encoding attribute in the saved document. The value of the encoding attribute is taken from the property. If the XmlDocument does not have an XmlDeclaration, or if the XmlDeclaration does not have an encoding attribute, the saved document will not have one either.
When the document is saved, xmlns attributes are generated to persist the node identity (local name + namespace URI) correctly. For example, the following C# code
XmlDocument doc = new XmlDocument();
doc.AppendChild(doc.CreateElement("item","urn:1"));
doc.Save(Console.Out);
generates this xmls attribute <item xmls="urn:1"/>.
This method is a Microsoft extension to the Document Object Model (DOM).
Note that only the method enforces a well-formed XML document. All other Save overloads only guarantee a well-formed fragment.
Saves the XML document to the specified stream.
The stream to which you want to save.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Void
The encoding on the TextWriter determines the encoding that is written out (The encoding of the XmlDeclaration node is replaced by the encoding of the TextWriter). If there was no encoding specified on the TextWriter, the XmlDocument is saved without an encoding attribute.
This method is a Microsoft extension to the Document Object Model (DOM).
Note that only the method enforces a well-formed XML document. All other Save overloads only guarantee a well-formed fragment.
Saves the XML document to the specified .
The TextWriter to which you want to save.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Void
White space is preserved in the output file only if is set to true.
The XmlDeclaration of the current XmlDocument object determines the encoding attribute in the saved document. The value of the encoding attribute is taken from the property. If the XmlDocument does not have an XmlDeclaration, or if the XmlDeclaration does not have an encoding attribute, the saved document will not have one either.
When the document is saved, xmlns attributes are generated to persist the node identity (local name + namespace URI) correctly. For example, the following C# code
XmlDocument doc = new XmlDocument();
doc.AppendChild(doc.CreateElement("item","urn:1"));
doc.Save(Console.Out);
generates this xmls attribute <item xmls="urn:1"/>.
This method is a Microsoft extension to the Document Object Model (DOM).
Note that only the method enforces a well-formed XML document. All other Save overloads only guarantee a well-formed fragment.
Saves the XML document to the specified file.
The location of the file where you want to save the document.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Void
White space is preserved only if is set to true.
The encoding on the XmlWriter determines the encoding that is written out (The encoding of the XmlDeclaration node is replaced by the encoding of the XmlWriter). If there was no encoding specified on the XmlWriter, the XmlDocument is saved without an encoding attribute.
When the document is saved, xmlns attributes are generated to persist the node identity (LocalName + NamespaceURI) correctly. For example, the following C# code
XmlDocument doc = new XmlDocument();
doc.AppendChild(doc.CreateElement("item","urn:1"));
doc.Save(Console.Out);
generates this xmls attribute:
<item
xmls="urn:1"/>
This method is a Microsoft extension to the Document Object Model (DOM).
Note that only the method enforces a well-formed XML document. All other Save overloads only guarantee a well-formed fragment.
Saves the XML document to the specified .
The XmlWriter to which you want to save.
Property
2.0.0.0
4.0.0.0
System.Xml.Schema.IXmlSchemaInfo
To be added.
The PSVI contents of this property are set after the node has been validated.
This property is a Microsoft extension to the Document Object Model (DOM).
Returns the Post-Schema-Validation-Infoset (PSVI) of the node.
Property
2.0.0.0
4.0.0.0
System.Xml.Schema.XmlSchemaSet
To be added.
The schemas contained in an object associated with an object are used for validation when the method of an is executed.
When an object is initialized with XML data from an object, the object is loaded from the property of the object.
Gets or sets the object associated with this .
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlLinkedNode
To be added.
To be added.
To be added.
Method
2.0.0.0
4.0.0.0
System.Void
The method validates the XML data in the against the schemas contained in the property. The method performs infoset augmentation. Specifically, after successful validation, schema defaults are applied, text values are converted to atomic values as necessary, and type information is associated with validated information items. The result is a previously un-typed XML sub-tree in the replaced with a typed sub-tree.
The following are important notes to consider when using the method.
-
Schema location hints like xsi:schemaLocation or xsi:noNamespaceSchemaLocation are ignored.
-
Inline schemas are ignored.
-
If schema validation errors occur during validation the becomes partially validated with some nodes with correct type information and some without.
-
The validation process includes checking for uniqueness and reference constraints (xs:ID, xs:IDREF, xs:key, xs:keyref, and xs:unique).
Validates the against the XML Schema Definition Language (XSD) schemas contained in the property.
The object that receives information about schema validation warnings and errors.
Method
2.0.0.0
4.0.0.0
System.Void
The method validates the XML data in the object against the schemas contained in the property. The method performs infoset augmentation. Specifically, after successful validation, schema defaults are applied, text values are converted to atomic values as necessary, and type information is associated with validated information items. The result is a previously un-typed XML sub-tree in the replaced with a typed sub-tree.
The following are important notes to consider when using the method.
-
Schema location hints like xsi:schemaLocation or xsi:noNamespaceSchemaLocation are ignored.
-
Inline schemas are ignored.
-
If schema validation errors occur during validation the becomes partially validated with some nodes with correct type information and some without.
If the node to validate is the root node, the validation process includes checking for uniqueness and reference constraints (xs:ID, xs:IDREF, xs:key, xs:keyref, and xs:unique); otherwise, uniqueness and reference constraints are omitted.
Validates the object specified against the XML Schema Definition Language (XSD) schemas in the property.
The object that receives information about schema validation warnings and errors.
The object created from an to validate.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Void
This method is a Microsoft extension to the Document Object Model (DOM). It is functionally equivalent to the property.
The property determines the encoding that is written out. If the Encoding property does not have a value, the XmlDocument is written out without an encoding attribute.
Saves all the children of the XmlDocument node to the specified .
The XmlWriter to which you want to save.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Void
This method is a Microsoft extension to the Document Object Model (DOM). It is functionally equivalent to the property.
The property determines the encoding that is written out. If the Encoding property does not have a value, the XmlDocument is written out without an encoding attribute.
Saves the XmlDocument node to the specified .
The XmlWriter to which you want to save.
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.Xml.XmlResolver
An object to resolve external resources, or null to prohibit to resolve external resources.
The XmlResolver can be used to load DTDs or expand entity references. Using the property, you can set credentials on the XmlResolver to access resources stored on a secure network resource.
-
If the document was not loaded using an (that is, if it was loaded using a stream, file, and so on) the XmlResolver on the XmlDocument is always used.
-
If the document was loaded with an , the resolver on the XmlTextReader is used to resolve any DTD references in the DocumentType node. The resolver on the XmlDocument is used to expand any entity references.
-
If the document was loaded with an , the resolver on the XmlDocument is never used.
-
If the document was loaded with a class that extends XmlReader and the XmlReader cannot resolve entities ( returns false), the XmlResolver on the XmlDocument is used to resolve any references in the DocumentType node and to expand any entity references.
If the XmlDocument is loaded using an which had an XmlResolver set to it, the XmlResolver on the XmlReader is not cached by the XmlDocument after completes.
In version 1.1 of the.NET Framework, if this property is not set, the trust level of the application determines the default behavior.
Fully trusted code: The document uses a default with no user credentials. If authentication is required to access a network resource, use the XmlResolver property to specify an XmlResolver with the necessary credentials.
Semi-trusted code: The XmlResolver property is set to null. External resources are not resolved.
For more information on security and the XmlResolver property, see [<topic://cpconresolvingexternalresources>].
This property is a Microsoft extension to the Document Object Model (DOM).
Sets the to use for resolving external resources.