XML parts integration

Modified on Mon, 5 Oct at 1:52 PM

Using normal DocumentData logic, we are able to fetch data from XML parts and output data to XML parts.

Fetching data

You can use the Document XML Viewer to inspect and edit XML parts in a document. Using the Doc.CustomXml prefix, you can insert through direct bindings in the document or define variables in DocumentData.

Example of usage

Code
{"SkabelonDesign":{"type":"text","binding":"Doc.CustomXml._dlc_DocIdUrl.Description"}}

Open the document with 7-zip and select customXml folder:

XML
<documentManagement>
...
  <_dlc_DocIdUrl xmlns="1234-1234-1234-1234-1234"> 
    <Url>https://clientNAme.sharepoint.com/_layouts/15/DocIdRedir.aspx?ID=1234-456789-123</Url> 
    <Description>1234-456789-123</Description> 
  </_dlc_DocIdUrl>
</documentManagement>

CMD for output

The following command can be used to write data from a DocumentData variable to a custom XML part:

<cmd case="SkabelonDesign.DocumentData:UpdateCustomXml"/>

Parameters

variableName

Define the variable name - this is the binding to the DocumentData variable holding the data to be written. This parameter is required.

xpath

Define the location of the XML part using the XPath syntax.

Example of usage

The following example will insert the value of the document property called test into the Line1 element of the documentManagement XML part.

XML
<button label="Update CustomXML">
  <cmd case="SkabelonDesign.DocumentData:EnablePendingChanges"/>
  <cmd case="SkabelonDesign.DocumentData:DefineData" variableName="test">
    <Doc.Prop.Test/>
  </cmd>
  <cmd case="SkabelonDesign.DocumentData:UpdateCustomXml" variableName="test" xpath="(//*[local-name() = 'documentManagement']/*[local-name() = 'Line1'])"/>
</button>

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article