DataBinding Class
XML Mapping.When the object is serialized out as xml, its qualified name is w:dataBinding.
Inheritance Hierarchy
System.Object
DocumentFormat.OpenXml.OpenXmlElement
DocumentFormat.OpenXml.OpenXmlLeafElement
DocumentFormat.OpenXml.Wordprocessing.DataBinding
Namespace: DocumentFormat.OpenXml.Wordprocessing
Assembly: DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)
Syntax
声明
Public Class DataBinding _
Inherits OpenXmlLeafElement
用法
Dim instance As DataBinding
public class DataBinding : OpenXmlLeafElement
Remarks
[ISO/IEC 29500-1 第 1 个版本]
17.5.2.6 dataBinding (XML Mapping)
This element specifies the information which shall be used to establish a mapping between the parent structured document tag and an XML element stored within a Custom XML Data part in the current WordprocessingML document.
If this element is omitted, then no XML mapping shall be associated with the current structured document tag. If the parent structured document tag is of type rich text or document part gallery, then this property shall be ignored.
If this element is present and the parent structured document tag is not of a rich text type, then the current value of the structured document tag shall be determined by finding the XML element (if any) which is determined by the attributes on this element. If this information does not result in an XML element, then the application can use any algorithm desired to find the closest available match. If this information does result in an XML element, then the contents of that element shall be used to replace the current run content within the document.
[Example: Consider the following structured document tag:
<w:sdt>
<w:sdtPr>
<w:dataBinding w:xpath="/root/name/first" … />
<w:text/>
</w:sdtPr>
<w:sdtContent>
<w:r>
<w:t>old text</w:t>
</w:r>
</w:sdtContent>
</w:sdt>
This structured document tag specifies that it contains only plain text via the text element, and that it must be mapped to the element in the first Custom XML Data part which contains an element that matches the XPath expression /root/name/first. When that element is located, its contents must replace the existing run content in the document (for example, if its contents are new text, then the contents of the run for this structured document tag must be new text when the document is displayed. end example]
Parent Elements |
---|
sdtPr (§17.5.2.38) |
Attributes |
Description |
---|---|
prefixMappings (XML Namespace Prefix Mappings) |
Specifies the set of prefix mappings which shall be used to interpret the XPath expression specified on the xpath attribute when the XPath expression is evaluated against the custom XML data parts in the current document. This attribute's value shall be specified using the following syntax: xmlns:prefix='namespace', where prefix is the namespace prefix to be mapped, and namespace is the namespace to be mapped to the current prefix. Each prefix mapping shall be delimited by one or more whitespace characters in the attribute's contents. If this attribute is omitted, then the prefix mappings specified on each of the custom XML data parts itself shall be used to evaluate the given XPath expression. [Example: Consider the following structured document tag properties:
This structured document tag specifies that it contains an XML mapping, and that mapping's prefixMapping attribute must signify that the set of namespace prefix mappings to be used to evaluate the xpath attribute value must be xmlns:ns0= 'http://example.com/example'. end example] The possible values for this attribute are defined by the ST_String simple type (§22.9.2.13). |
storeItemID (Custom XML Data Storage ID) |
Specifies the custom XML data identifier for the custom XML data part which shall be used to evaluate the given XPath expression. The custom XML data identifier, specified using the storeItemID attribute of the dataStoreItem element (§22.5.2.1) on the Custom XML Data Properties part is a string that uniquely identifies a particular custom XML data part in a WordprocessingML document (as multiple parts can have the same namespace for their root element). If specified, then the XPath expression specified on the xpath attribute shall only be evaluated against the custom XML data part whose properties part has a matching custom XML data identifier. If no custom XML data part exists with a matching identifier, then the XML mapping shall not be connected. If omitted, then the XPath expression shall be evaluated against each custom XML data part in turn until the given XPath expression is resolved to an XML element. [Example: Consider the following structured document tag properties:
This structured document tag specifies that it contains an XML mapping, and that mapping must only be evaluated against the custom XML part whose identifier is equal to testXmlPart (if one exists). end example] The possible values for this attribute are defined by the ST_String simple type (§22.9.2.13). |
xpath (XPath) |
Specifies the XPath expression which shall be evaluated to find the custom XML node which is mapped to the parent structured document tag. This XPath expression shall be specified using the syntax defined in the XML Path Language (XPath) Version 1.0 specification (see Annex A for bibliographic reference information). [Example: Consider the following structured document tag properties:
This structured document tag specifies that it contains an XML mapping, and that mapping's xpath attribute must signify that the XPath expression to be evaluated must be //ns0:book. Because the prefixMapping attribute is also specified, those prefix mappings must be used to evaluate this XPath expression. end example] The possible values for this attribute are defined by the ST_String simple type (§22.9.2.13). |
[Note: The W3C XML Schema definition of this element's content model (CT_DataBinding) is located in §A.1. end note]
© ISO/IEC29500: 2008. 以上摘要已经由 Microsoft(和/或其代理公司)从英语翻译为简体中文,ISO 对此翻译不承担任何责任。
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.