XmlDataDocument 类

定义

注意

XmlDataDocument class will be removed in a future release.

允许通过相关的 DataSet 存储、检索和操作结构化数据。Allows structured data to be stored, retrieved, and manipulated through a relational DataSet.

public ref class XmlDataDocument : System::Xml::XmlDocument
[System.Obsolete("XmlDataDocument class will be removed in a future release.")]
public class XmlDataDocument : System.Xml.XmlDocument
public class XmlDataDocument : System.Xml.XmlDocument
[<System.Obsolete("XmlDataDocument class will be removed in a future release.")>]
type XmlDataDocument = class
    inherit XmlDocument
type XmlDataDocument = class
    inherit XmlDocument
Public Class XmlDataDocument
Inherits XmlDocument
继承
XmlDataDocument
属性

注解

此类扩展 XmlDocumentThis class extends XmlDocument. 它使您可以加载关系数据或 XML 数据,并使用万维网联合会 (W3C) 文档对象模型 (DOM) 来处理数据。It enables you to load either relational data or XML data and manipulate that data using the World Wide Web Consortium (W3C) Document Object Model (DOM). DOM 将数据显示为节点对象的层次结构。The DOM presents data as a hierarchy of node objects. 由于 XmlDataDocument 实现了 IXPathNavigable 接口,因此它还可用作类的源文档 XslTransformBecause XmlDataDocument implements the IXPathNavigable interface, it can also be used as the source document for the XslTransform class.

XmlDataDocument 具有与类的紧密隶属关系 DataSet ,该类提供加载的 XML 数据的关系视图。XmlDataDocument has a close affiliation with the DataSet class, which provides a relational view of the loaded XML data. 对所做的任何更改 XmlDataDocument 都会反映在中 DataSet ,反之亦然。Any changes made to the XmlDataDocument are reflected in the DataSet and vice versa.

若要加载 DataSet 具有 XML 数据的,请使用 ReadXmlSchema 生成关系映射。To load a DataSet with XML data, use ReadXmlSchema to build a relational mapping. 然后,可以使用或加载 XML 数据 Load LoadXmlThe XML data can then be loaded using Load or LoadXml.

若要加载关系数据,请 DataSet 在构造函数中指定包含关系数据的作为参数 XmlDataDocumentTo load relational data, specify the DataSet containing the relational data as the parameter in the XmlDataDocument constructor.

构造函数

XmlDataDocument()

初始化 XmlDataDocument 类的新实例。Initializes a new instance of the XmlDataDocument class.

XmlDataDocument(DataSet)

使用指定的 XmlDataDocument 初始化 DataSet 类的新实例。Initializes a new instance of the XmlDataDocument class with the specified DataSet.

属性

Attributes

获取一个 XmlAttributeCollection,它包含该节点的特性。Gets an XmlAttributeCollection containing the attributes of this node.

(继承自 XmlNode)
BaseURI

获取当前节点的基 URI。Gets the base URI of the current node.

(继承自 XmlDocument)
ChildNodes

获取节点的所有子节点。Gets all the child nodes of the node.

(继承自 XmlNode)
DataSet

获取 DataSet,该数据集提供 XmlDataDocument 中数据的关系表示形式。Gets a DataSet that provides a relational representation of the data in the XmlDataDocument.

DocumentElement

获取文档的根 XmlElementGets the root XmlElement for the document.

(继承自 XmlDocument)
DocumentType

获取包含 DOCTYPE 声明的节点。Gets the node containing the DOCTYPE declaration.

(继承自 XmlDocument)
FirstChild

获取节点的第一个子级。Gets the first child of the node.

(继承自 XmlNode)
HasChildNodes

获取一个值,该值指示此节点是否有任何子节点。Gets a value indicating whether this node has any child nodes.

(继承自 XmlNode)
Implementation

获取当前文档的 XmlImplementation 对象。Gets the XmlImplementation object for the current document.

(继承自 XmlDocument)
InnerText

在所有情况下引发 InvalidOperationExceptionThrows an InvalidOperationException in all cases.

(继承自 XmlDocument)
InnerXml

获取或设置表示当前节点的子级的标记。Gets or sets the markup representing the children of the current node.

(继承自 XmlDocument)
IsReadOnly

获取一个值,该值指示当前节点是否是只读的。Gets a value indicating whether the current node is read-only.

(继承自 XmlDocument)
Item[String, String]

获取具有指定 LocalNameNamespaceURI 的第一个子元素。Gets the first child element with the specified LocalName and NamespaceURI.

(继承自 XmlNode)
Item[String]

获取具有指定 Name 的第一个子元素。Gets the first child element with the specified Name.

(继承自 XmlNode)
LastChild

获取节点的最后一个子级。Gets the last child of the node.

(继承自 XmlNode)
LocalName

获取节点的本地名称。Gets the local name of the node.

(继承自 XmlDocument)
Name

获取节点的限定名称。Gets the qualified name of the node.

(继承自 XmlDocument)
NamespaceURI

获取该节点的命名空间 URI。Gets the namespace URI of this node.

(继承自 XmlNode)
NameTable

获取与此实现关联的 XmlNameTableGets the XmlNameTable associated with this implementation.

(继承自 XmlDocument)
NextSibling

获取紧接在该节点之后的节点。Gets the node immediately following this node.

(继承自 XmlNode)
NodeType

获取当前节点的类型。Gets the type of the current node.

(继承自 XmlDocument)
OuterXml

获取包含此节点及其所有子节点的标记。Gets the markup containing this node and all its child nodes.

(继承自 XmlNode)
OwnerDocument

获取当前节点所属的 XmlDocumentGets the XmlDocument to which the current node belongs.

(继承自 XmlDocument)
ParentNode

获取该节点的父节点(针对可以拥有父级的节点)。Gets the parent node of this node (for nodes that can have parents).

(继承自 XmlDocument)
Prefix

获取或设置该节点的命名空间前缀。Gets or sets the namespace prefix of this node.

(继承自 XmlNode)
PreserveWhitespace

获取或设置一个值,该值指示是否在元素内容中保留空白区域。Gets or sets a value indicating whether to preserve white space in element content.

(继承自 XmlDocument)
PreviousSibling

获取紧接在该节点之前的节点。Gets the node immediately preceding this node.

(继承自 XmlNode)
PreviousText

获取紧接在该节点之前的文本节点。Gets the text node that immediately precedes this node.

(继承自 XmlNode)
SchemaInfo

返回节点的后架构验证信息集 (PSVI)。Returns the Post-Schema-Validation-Infoset (PSVI) of the node.

(继承自 XmlDocument)
Schemas

获取或设置与此 XmlDocument 关联的 XmlSchemaSet 对象。Gets or sets the XmlSchemaSet object associated with this XmlDocument.

(继承自 XmlDocument)
Value

获取或设置节点的值。Gets or sets the value of the node.

(继承自 XmlNode)
XmlResolver

设置 XmlResolver 以用于解析外部资源。Sets the XmlResolver to use for resolving external resources.

(继承自 XmlDocument)

方法

AppendChild(XmlNode)

将指定的节点添加到该节点的子节点列表的末尾。Adds the specified node to the end of the list of child nodes, of this node.

(继承自 XmlNode)
Clone()

创建此节点的副本。Creates a duplicate of this node.

(继承自 XmlNode)
CloneNode(Boolean)

创建当前节点的副本。Creates a duplicate of the current node.

CreateAttribute(String)

创建具有指定 NameXmlAttributeCreates an XmlAttribute with the specified Name.

(继承自 XmlDocument)
CreateAttribute(String, String)

创建具有指定限定名和 NamespaceURIXmlAttributeCreates an XmlAttribute with the specified qualified name and NamespaceURI.

(继承自 XmlDocument)
CreateAttribute(String, String, String)

创建一个具有指定的 PrefixLocalNameNamespaceURIXmlAttributeCreates an XmlAttribute with the specified Prefix, LocalName, and NamespaceURI.

(继承自 XmlDocument)
CreateCDataSection(String)

创建包含指定数据的 XmlCDataSectionCreates an XmlCDataSection containing the specified data.

(继承自 XmlDocument)
CreateComment(String)

创建包含指定数据的 XmlCommentCreates an XmlComment containing the specified data.

(继承自 XmlDocument)
CreateDefaultAttribute(String, String, String)

创建具有指定前缀、本地名称和命名空间 URI 的默认属性。Creates a default attribute with the specified prefix, local name and namespace URI.

(继承自 XmlDocument)
CreateDocumentFragment()

创建 XmlDocumentFragmentCreates an XmlDocumentFragment.

(继承自 XmlDocument)
CreateDocumentType(String, String, String, String)

返回新 XmlDocumentType 对象。Returns a new XmlDocumentType object.

(继承自 XmlDocument)
CreateElement(String)

创建具有指定名称的元素。Creates an element with the specified name.

(继承自 XmlDocument)
CreateElement(String, String)

创建具有限定名和 NamespaceURIXmlElementCreates an XmlElement with the qualified name and NamespaceURI.

(继承自 XmlDocument)
CreateElement(String, String, String)

创建具有指定 PrefixLocalNameNamespaceURI 的元素。Creates an element with the specified Prefix, LocalName , and NamespaceURI.

CreateEntityReference(String)

创建具有指定名称的 XmlEntityReferenceCreates an XmlEntityReference with the specified name.

CreateNavigator()

创建一个用于导航此文档的新 XPathNavigator 对象。Creates a new XPathNavigator object for navigating this document.

(继承自 XmlDocument)
CreateNavigator(XmlNode)

创建一个用于导航此文档的新 XPathNavigator 对象。Creates a new XPathNavigator object for navigating this document. XPathNavigator 定位在 node 参数中指定的节点上。The XPathNavigator is positioned on the node specified in the node parameter.

CreateNode(String, String, String)

创建具有指定的节点类型、NameNamespaceURIXmlNodeCreates an XmlNode with the specified node type, Name, and NamespaceURI.

(继承自 XmlDocument)
CreateNode(XmlNodeType, String, String)

创建一个具有指定的 XmlNodeTypeNameNamespaceURIXmlNodeCreates an XmlNode with the specified XmlNodeType, Name, and NamespaceURI.

(继承自 XmlDocument)
CreateNode(XmlNodeType, String, String, String)

创建一个具有指定的XmlNodeTypePrefixNameNamespaceURIXmlNodeCreates a XmlNode with the specified XmlNodeType, Prefix, Name, and NamespaceURI.

(继承自 XmlDocument)
CreateProcessingInstruction(String, String)

创建一个具有指定名称和数据的 XmlProcessingInstructionCreates an XmlProcessingInstruction with the specified name and data.

(继承自 XmlDocument)
CreateSignificantWhitespace(String)

创建一个 XmlSignificantWhitespace 节点。Creates an XmlSignificantWhitespace node.

(继承自 XmlDocument)
CreateTextNode(String)

创建具有指定文本的 XmlTextCreates an XmlText with the specified text.

(继承自 XmlDocument)
CreateWhitespace(String)

创建一个 XmlWhitespace 节点。Creates an XmlWhitespace node.

(继承自 XmlDocument)
CreateXmlDeclaration(String, String, String)

创建一个具有指定值的 XmlDeclaration 节点。Creates an XmlDeclaration node with the specified values.

(继承自 XmlDocument)
Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetElementById(String)

获取具有指定 ID 的 XmlElementGets the XmlElement with the specified ID. XmlDataDocument 类不支持该方法。This method is not supported by the XmlDataDocument class. 调用此方法将引发异常。Calling this method throws an exception.

GetElementFromRow(DataRow)

检索与指定 XmlElement 关联的 DataRowRetrieves the XmlElement associated with the specified DataRow.

GetElementsByTagName(String)

返回一个 XmlNodeList,它包含与指定 Name 匹配的所有子代元素的列表。Returns an XmlNodeList containing a list of all descendant elements that match the specified Name.

GetElementsByTagName(String)

返回一个 XmlNodeList,它包含与指定 Name 匹配的所有子代元素的列表。Returns an XmlNodeList containing a list of all descendant elements that match the specified Name.

(继承自 XmlDocument)
GetElementsByTagName(String, String)

返回一个 XmlNodeList,它包含与指定 LocalNameNamespaceURI 匹配的所有子代元素的列表。Returns an XmlNodeList containing a list of all descendant elements that match the specified LocalName and NamespaceURI.

(继承自 XmlDocument)
GetEnumerator()

获取循环访问当前节点中子节点的枚举数。Gets an enumerator that iterates through the child nodes in the current node.

(继承自 XmlNode)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetNamespaceOfPrefix(String)

查找当前节点范围内离给定的前缀最近的 xmlns 声明,并返回声明中的命名空间 URI。Looks up the closest xmlns declaration for the given prefix that is in scope for the current node and returns the namespace URI in the declaration.

(继承自 XmlNode)
GetPrefixOfNamespace(String)

查找当前节点范围内离给定的命名空间 URI 最近的 xmlns 声明,并返回声明中定义的前缀。Looks up the closest xmlns declaration for the given namespace URI that is in scope for the current node and returns the prefix defined in that declaration.

(继承自 XmlNode)
GetRowFromElement(XmlElement)

检索与指定 DataRow 关联的 XmlElementRetrieves the DataRow associated with the specified XmlElement.

GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
ImportNode(XmlNode, Boolean)

将节点从另一个文档导入到当前文档。Imports a node from another document to the current document.

(继承自 XmlDocument)
InsertAfter(XmlNode, XmlNode)

将指定的节点紧接着插入指定的引用节点之后。Inserts the specified node immediately after the specified reference node.

(继承自 XmlNode)
InsertBefore(XmlNode, XmlNode)

将指定的节点紧接着插入指定的引用节点之前。Inserts the specified node immediately before the specified reference node.

(继承自 XmlNode)
Load(Stream)

从指定的流加载 XmlDataDocumentLoads the XmlDataDocument from the specified stream.

Load(String)

使用指定的 URL 加载 XmlDataDocumentLoads the XmlDataDocument using the specified URL.

Load(TextReader)

从指定的 TextReader 加载 XmlDataDocumentLoads the XmlDataDocument from the specified TextReader.

Load(XmlReader)

从指定的 XmlReader 加载 XmlDataDocumentLoads the XmlDataDocument from the specified XmlReader.

LoadXml(String)

从指定的字符串加载 XML 文档。Loads the XML document from the specified string.

(继承自 XmlDocument)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
Normalize()

将此 XmlNode 下子树完全深度中的所有 XmlText 节点都转换成“正常”形式,在这种形式中只有标记(即标记、注释、处理指令、CDATA 节和实体引用)分隔 XmlText 节点,也就是说,没有相邻的 XmlText 节点。Puts all XmlText nodes in the full depth of the sub-tree underneath this XmlNode into a "normal" form where only markup (that is, tags, comments, processing instructions, CDATA sections, and entity references) separates XmlText nodes, that is, there are no adjacent XmlText nodes.

(继承自 XmlNode)
PrependChild(XmlNode)

将指定的节点添加到该节点的子节点列表的开头。Adds the specified node to the beginning of the list of child nodes for this node.

(继承自 XmlNode)
ReadNode(XmlReader)

根据 XmlReader 中的信息创建一个 XmlNode 对象。Creates an XmlNode object based on the information in the XmlReader. 读取器必须定位在节点或属性上。The reader must be positioned on a node or attribute.

(继承自 XmlDocument)
RemoveAll()

移除当前节点的所有子节点和/或属性。Removes all the child nodes and/or attributes of the current node.

(继承自 XmlNode)
RemoveChild(XmlNode)

移除指定的子节点。Removes specified child node.

(继承自 XmlNode)
ReplaceChild(XmlNode, XmlNode)

oldChild 节点替换子节点 newChildReplaces the child node oldChild with newChild node.

(继承自 XmlNode)
Save(Stream)

将 XML 文档保存到指定的流。Saves the XML document to the specified stream.

(继承自 XmlDocument)
Save(String)

将 XML 文档保存到指定的文件。Saves the XML document to the specified file. 如果存在指定文件,则此方法会覆盖它。If the specified file exists, this method overwrites it.

(继承自 XmlDocument)
Save(TextWriter)

将 XML 文档保存到指定的 TextWriterSaves the XML document to the specified TextWriter.

(继承自 XmlDocument)
Save(XmlWriter)

将 XML 文档保存到指定的 XmlWriterSaves the XML document to the specified XmlWriter.

(继承自 XmlDocument)
SelectNodes(String)

选择匹配 XPath 表达式的节点列表。Selects a list of nodes matching the XPath expression.

(继承自 XmlNode)
SelectNodes(String, XmlNamespaceManager)

选择匹配 XPath 表达式的节点列表。Selects a list of nodes matching the XPath expression. XPath 表达式中的任何前缀都使用提供的 XmlNamespaceManager 进行解析。Any prefixes found in the XPath expression are resolved using the supplied XmlNamespaceManager.

(继承自 XmlNode)
SelectSingleNode(String)

选择匹配 XPath 表达式的第一个 XmlNodeSelects the first XmlNode that matches the XPath expression.

(继承自 XmlNode)
SelectSingleNode(String, XmlNamespaceManager)

选择匹配 XPath 表达式的第一个 XmlNodeSelects the first XmlNode that matches the XPath expression. XPath 表达式中的任何前缀都使用提供的 XmlNamespaceManager 进行解析。Any prefixes found in the XPath expression are resolved using the supplied XmlNamespaceManager.

(继承自 XmlNode)
Supports(String, String)

测试 DOM 实现是否实现特定的功能。Tests if the DOM implementation implements a specific feature.

(继承自 XmlNode)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)
Validate(ValidationEventHandler)

验证 XmlDocument 是不是 Schemas 属性中包含的 XML 架构定义语言 (XSD) 架构。Validates the XmlDocument against the XML Schema Definition Language (XSD) schemas contained in the Schemas property.

(继承自 XmlDocument)
Validate(ValidationEventHandler, XmlNode)

根据 Schemas 属性中的 XML 架构定义语言 (XSD) 架构,验证指定的 XmlNode 对象。Validates the XmlNode object specified against the XML Schema Definition Language (XSD) schemas in the Schemas property.

(继承自 XmlDocument)
WriteContentTo(XmlWriter)

XmlDocument 节点的所有子级保存到指定的 XmlWriter 中。Saves all the children of the XmlDocument node to the specified XmlWriter.

(继承自 XmlDocument)
WriteTo(XmlWriter)

XmlDocument 节点保存到指定的 XmlWriterSaves the XmlDocument node to the specified XmlWriter.

(继承自 XmlDocument)

事件

NodeChanged

当属于该文档的节点的 Value 已被更改时发生。Occurs when the Value of a node belonging to this document has been changed.

(继承自 XmlDocument)
NodeChanging

当属于该文档的节点的 Value 将被更改时发生。Occurs when the Value of a node belonging to this document is about to be changed.

(继承自 XmlDocument)
NodeInserted

将属于该文档的节点插入另一个节点时发生。Occurs when a node belonging to this document has been inserted into another node.

(继承自 XmlDocument)
NodeInserting

当属于该文档的节点将被插入另一个节点时发生。Occurs when a node belonging to this document is about to be inserted into another node.

(继承自 XmlDocument)
NodeRemoved

当属于该文档的节点已从其父级中移除时发生。Occurs when a node belonging to this document has been removed from its parent.

(继承自 XmlDocument)
NodeRemoving

当属于该文档的节点将从文档中移除时发生。Occurs when a node belonging to this document is about to be removed from the document.

(继承自 XmlDocument)

显式接口实现

ICloneable.Clone()

有关此成员的说明,请参见 Clone()For a description of this member, see Clone().

(继承自 XmlNode)
IEnumerable.GetEnumerator()

有关此成员的说明,请参见 GetEnumerator()For a description of this member, see GetEnumerator().

(继承自 XmlNode)

扩展方法

Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

启用查询的并行化。Enables parallelization of a query.

AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.

CreateNavigator(XmlDocument)

创建用于导航指定文档的新 XPath 导航器对象。Creates a new XPath navigator object for navigating the specified document.

CreateNavigator(XmlDocument, XmlNode)

创建用于在指定节点上导航指定文档的 XPath 导航器对象。Creates an XPath navigator object for navigating the specified document positioned on the specified node.

CreateNavigator(XmlNode)

创建用于导航指定节点的 XPath 导航器。Creates an XPath navigator for navigating the specified node.

SelectNodes(XmlNode, String)

选择与指定的 XPath 表达式匹配的节点列表。Selects a list of nodes matching the specified XPath expression.

SelectNodes(XmlNode, String, XmlNamespaceManager)

选择与指定的 XPath 表达式匹配的节点列表。Selects a list of nodes matching the specified XPath expression. 使用提供的命名空间管理器解析 XPath 表达式中的任何前缀。Any prefixes found in the XPath expression are resolved using the supplied namespace manager.

SelectSingleNode(XmlNode, String)

选择与 XPath 表达式匹配的第一个节点。Selects the first node that matches the XPath expression.

SelectSingleNode(XmlNode, String, XmlNamespaceManager)

选择与 XPath 表达式匹配的第一个节点。Selects the first node that matches the XPath expression. 使用提供的命名空间管理器解析 XPath 表达式中的任何前缀。Any prefixes found in the XPath expression are resolved using the supplied namespace manager.

ToXPathNavigable(XmlNode)

创建 IXPathNavigable 用于生成导航器的实例。Creates an IXPathNavigable instance used for producing navigators.

适用于