XMLMapping.XPath XMLMapping.XPath XMLMapping.XPath Property

Definition

Returns a String that represents the XPath for the XML mapping, which evaluates to the currently mapped XML node. Read-only.

public:
 property System::String ^ XPath { System::String ^ get(); };
public string XPath { get; }
Public ReadOnly Property XPath As String
Property Value

Examples

The following example checks whether the first content control in the active document is a date control and whether the XPath string is set to a specific built-in document property. It then sets the mapping to the control, if the XPath does not match and the control is a date control.

<span class="label">Dim objCC As ContentControl































































































































Dim objMap As XMLMapping































































































































Dim blnMap As Boolean































































































































































































































































Set objCC = ActiveDocument.ContentControls(1)































































































































Set objMap = objCC.XMLMapping































































































































































































































































If (objCC.Type = wdContentControlDate) And (objMap.</span>
<span class="label">XPath</span>
<span class="label">&lt;&gt; _        "/ns1:coreProperties[1]/ns0:createdate[1]") Then    blnMap = objMap.SetMapping(XPath:="/ns1:coreProperties[1]/ns0:createdate[1]")    If blnMap = False Then        MsgBox "Unable to map the content control."    End IfEnd If</span>

Remarks

To set mapping for a content control, use the SetMapping(String, String, CustomXMLPart) method or the SetMappingByNode(CustomXMLNode) method. If the mapping is not active, using this property returns an error.

Applies to