<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 a valid XML element, then the application may use any algorithm desired to find the closest available match. If this information does result in a valid XML element, then the contents of that element shall be used to replace the current run content within the document.

example:
<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 shall 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 shall 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 shall be new text when the document is displayed. ]

Parent Elements

<sdtPr>2.5.2.37)

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.

<w:sdtPr>
  <w:dataBinding w:xpath="//ns0:book" w:prefixMapping="xmlns:ns0=
'http://example.com/example'"/>
  <w:text/>
</w:sdtPr>

This structured document tag specifies that it contains an XML mapping, and that mapping's @prefixMapping attribute shall signify that the set of namespace prefix mappings to be used to evaluate the @xpath attribute value shall be xmlns:ns0= 'http://example.com/example'. ]

The possible values for this attribute are defined by the ST_String simple type (§2.18.89).

<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 (§7.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 may 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.

<w:sdtPr>
  <w:dataBinding w:xpath="//ns0:book" w:storeItemID="testXmlPart"
/>
  <w:text/>
</w:sdtPr>

This structured document tag specifies that it contains an XML mapping, and that mapping shall only be evaluated against the custom XML part whose identifier is equal to testXmlPart (if one exists). ]

The possible values for this attribute are defined by the ST_String simple type (§2.18.89).

<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).

<w:sdtPr>
  <w:dataBinding w:xpath="//ns0:book" w:prefixMapping="xmlns:ns0=
'http://example.com/example'"/>
  <w:text/>
</w:sdtPr>

This structured document tag specifies that it contains an XML mapping, and that mapping's @xpath attribute shall signify that the XPath expression to be evaluated shall be //ns0:book. Because the @prefixMapping attribute is also specified, those prefix mappings shall be used to evaluate this XPath expression. ]

The possible values for this attribute are defined by the ST_String simple type (§2.18.89).

The following XML Schema fragment defines the contents of this element:

<complexType name="CT_DataBinding">
	<attribute name="prefixMappings" type="ST_String"/>
	<attribute name="xpath" type="ST_String" use="required"/>
	<attribute name="storeItemID" type="ST_String" use="required"/>
</complexType>