Microsoft.SqlServer.XMLTask 命名空间包含用于 XML 任务(用于使用 XML 数据)的接口和类。使用此任务,包可以检索文件中存储的 XML 文档,使用 XSL 转换、(XSLT) 样式表和 XPath 表达式对文档应用运算,合并多个文档,以及验证和比较文档并将更新的文档保存到文件和变量。 指定在比较 XML 文档时要使用的算法。 默认值。根据比较文档的大小和假定更改数,为您选择比较算法。 通过遍历 XML 树并逐个节点地进行比较,比较两个 XML 文档。此算法非常快,但产生的结果可能不太精确。例如,它可以检测到对某一节点的添加和删除操作,但检测不到移动操作。 基于用于查找树之间的编辑距离的算法(也称作 Zhang Shasha 算法),对文件进行比较。此算法将提供非常精确的结果,但对于具有很多更改的大型 XML 文档,算法的执行速度可能会非常慢。 设置为 时,使用此枚举来设置影响比较的行为的选项以及最终生成的 XDL DiffGram。使用的枚举将确定在比较过程中考虑要包括哪些项。 指定每个元素的子节点的顺序将被忽略。在选择此选项后,如果两个节点具有相同的值,仅是其在同级子节点中的位置不同,则这两个节点将视作相同的节点。 指定不比较注释节点。 指定不比较文档类型声明 (DTD)。 指定不比较元素的命名空间统一资源标识符 (URI) 和属性名称。此选项还意味着名称前缀将被忽略。 指定不比较元素和属性名称的命名空间 URI。此选项还意味着名称前缀将被忽略。 指定不比较元素和属性名称的前缀。在选择此选项后,如果两个名称具有相同的本地名称和命名空间 URI,但具有不同的前缀,则这两个名称将被视作相同名称。 指定不比较有效空白,并且指定通过放弃所有前导和尾随空白字符(#x9、#x10、#x13、#x20)并用单个空格字符 (#x20) 替换空白字符序列,标准化所有文本节点。 指定不比较 XML 声明。 指定不使用在枚举中找到的选项。 指定在使用 XML 文档时所使用的操作。 比较两个 XML 文档。通过使用源 XML 文档作为基文档,此 Diff 运算将该文档与其他 XML 文档进行比较,发现两者之间的差异,然后将这些差异写入某一 XML DiffGram 文档。此运算包含用来自定义比较的属性。 合并两个 XML 文档。通过使用源 XML 文档作为基文档,将第二个文档合并到该基文档中。此运算可以指定文档中的合并位置。 将 Diff 运算的输出(DiffGram 文档)应用到 XML 文档,以便创建包含该 DiffGram 文档内容的新的父文档。 根据文档类型定义 (DTD) 或 XML 架构定义 (XSD) 验证 XML 文档。 执行 XPath 查询和计算。 对 XML 文档执行 XSL 转换。 描述用于保存结果的位置。该枚举用于设置 属性。根据值, 属性必须兼容。例如,如果目标类型设置为 ,则目标属性必须提供要将结果保存到的变量。当目标类型设置为 时, 属性必须提供文件连接管理器。 指定将结果保存到在连接管理器字符串中列出的文件。 指定将结果保存在某一变量中。 描述 的位置、 中 XPath 字符串的源类型以及 中第二个操作数的类型。根据所使用的类型, 属性必须兼容。例如,如果 设置为 ,则 必须包含连接管理器。如果 ,则 必须指向要使用的变量。 指定 XML 文档以纯文本格式直接输入到任务用户界面上的某个区域中。仅当提供任务的用户界面时,才使用此选项。 指定 XML 文档将保存在某一文件中。该任务与连接管理器交互,以便从文件检索 XML 文档。如果您正在为此任务编写用户界面,则支持文件连接管理器检索的操作还应提供一个“新建连接”按钮,从而允许用户在编辑该任务时创建新连接。 指定 XML 文档将保存在某一变量中。 指定操作使用的验证的类型。仅当 时,才使用此枚举。默认值是 XML 架构,这是 XSD 的值。 指定验证分析器将要检索文档类型定义 (DTD) 并且确保文档符合该 DTD 描述的语法。 默认值。指定通过使用 XML 架构验证服务对文档进行验证。 确定执行的 XPATH 功能的类型。 此枚举由 使用。 在您需要利用 sum() 之类的 XPATH 功能时使用此枚举值。 在您希望返回将所有节点作为 XML 片段包含的节点列表时使用此枚举值。 在您希望所有节点的内部文本值串联为一个字符串时使用此枚举值。它还提供对 text() 函数的支持。 包含用于根据 属性(这是来自 枚举的值)运行若干 XML 任务的成员。无法继承此类。 初始化 类的新实例。 传递给某一任务。该任务将使用断点管理器来创建、删除和检查断点的状态。此方法由运行时调用,在代码中未使用。 The breakpoint manager specific for this task. 运行任务。 A that indicates the outcome of the execution. A collection for the task. A object for locking variables. An interface to raise events. An interface. The transaction object that the task is part of. This value can be null. 初始化与该任务相关联的属性。此方法由运行时调用,在代码中未使用。 A collection of used by the task. A object for locking variables. An object that implements the interface. An object that implements the interface. A collection that contains the events to be raised during execution of the task. A collection of log entries. An object reference tracker. 此方法不能由应用程序代码调用。若要加载保存为 .xml 的包,请使用 方法。 The XmlElement that contains the information to load. An object that implements the interface for raising events during persistence. 暂停后恢复执行任务。由运行时引擎恢复任务或容器。 此方法不能由应用程序代码调用。若将包保存为 .xml,请使用 方法。 The XML document to which to save the information. An object that implements the interface for firing events (errors, warnings, and so on) during persistence. 指示可执行文件需要挂起。运行时引擎调用此方法。 验证该组件已正确配置。 A value from the enumeration. A collection of used by the task. A object for locking variables. An object that implements the interface. An object that implements the interface. 一个布尔值,该值指示某一任务是否应检查断点启用与否。 true indicates that the task checks for enabled breakpoints. 获取或设置 XML 任务将操作结果保存到的连接或变量的名称。 A String that contains the name of the connection or variable to which the XML task saves the results of the operation. 获取或设置一个 枚举值,该值指示 XML 任务将 XML 文档保存到的目标的类型。 A value from the enumeration that indicates the type of destination to which the XML task saves the XML document. 获取或设置在 时使用的比较算法。 A value from the enumeration that indicates the comparison algorithm. 获取或设置 XML 任务将 DiffGram 文档保存到的连接或变量的名称。 A String that indicates the name of the connection or variable to which the XML task saves the DiffGram document. 获取或设置一个值,该值指示 XML 任务将 DiffGram 文档保存到的目标的类型。 A value from the enumeration that indicates the type of destination to which the XML task saves the DiffGram document. 获取或设置一个值,该值指示在比较文档时该操作将使用的选项。 A value from the enumeration that indicates the options the operation uses when comparing documents. 返回任务执行的结果。 A user-defined object. 获取或设置一个布尔值,该值指示如果 XML 文档无法根据验证架构进行验证,该任务是否失败。 true if the task fails if the XML document fails to validate according to the validation schema; false if XML validation does not affect task success. 获取或设置一个布尔值,该值指示在验证失败时该操作是否失败。 A Boolean that indicates whether the operation fails when a validation fails. 获取一个 ArrayList 类,其中包含 XPath 运算生成的节点集合。 An ArrayList class that contains a collection of nodes that the XPath operation produces. 获取或设置一个 枚举值,该值指示任务执行的操作的类型,例如验证或合并。 A value from the enumeration that indicates the type of the operation that the task performs. 获取或设置一个布尔值,该值指示该操作是否将覆盖现有目标文件。 true if the operation overwrites existing destination files. 获取或设置一个布尔值,该值指示该操作是否将结果放置于一个节点中。 true if the operation places the result in one node. 获取或设置一个布尔值,该值指示是否保存比较结果,即一个 DiffGram 文档。 true if the comparison result, a DiffGram document, is saved. 获取或设置一个布尔值,该值指示 XML 任务是否保存 Diff 操作输出。 true if the XML task saves the Diff operation output. 获取或设置作为使用两个操作数的操作中第二个操作数的连接的名称、变量或用户提供的文本。根据所执行的操作,此第二个操作数可以是 XML 文档、DiffGram、XSLT、XPath 或验证文档。 A String that contains the name of the connection, the variable, or the user-provided text that is the second operand. 获取或设置一个值,该值指示包含在 中找到的 XML 文档、DiffGram、XSLT、XPath 或验证文档的源的类型。 A value from the enumeration that indicates the type of source that contains the data in the second operand. 获取或设置作为操作使用的源的连接的名称、变量或用户提供的文本。 A String that contains the name of the connection, the variable, or the user-provided text that is the source the operation uses. 获取或设置来自 枚举的一个值,该值指示包含操作使用的 XML 文档的源的类型。 A value from the enumeration that indicates the type of source that contains the XML document the operation uses. 获取或设置一个布尔值,该值指示在遇到断点时任务是否应挂起。遇到断点时,将由任务和容器的运行时引擎设置此值。 true if that the task suspends. 获取或设置一个 枚举值,该值指示操作使用的验证的类型。 A value from the enumeration that indicates the type of validation the operation uses. 获取或设置一个 枚举值,该值指示要执行的 XPath 运算。 A value from the enumeration that indicates the XPath operation to perform. 获取或设置 XPath 表达式的源。 A String that contains the source of the XPath expression. 获取或设置来自 枚举的一个值,该值指示在 属性中包含 XPath 表达式的源的类型。 A value from the enumeration that indicates the type of the source that contains the XPath expression.