Connect XML
The default case receives instructions for the document creation in XML and Connect interface definition.
Connect interface definition
The interface definition lets the Word editor know which fields will provide values in the future and can be inserted and formatted in the document as placeholders. These elements are available via "primedocs Design" → "Link Content" in the category "Interfaces".
<CustomInterfaces>
<InterfaceDescription Name="ContosoInterface" Description="Interface Contoso">
<Node Id="ContosoInterface.CompanyName">[CompanyName placeholder]</Node>
<Node Id="ContosoInterface.CompanyDivision">[CompanyDivision placeholder]</Node>
</InterfaceDescription>
</CustomInterfaces>
The corresponding definition in the connect file looks like this:
<?xml version="1.0" encoding="utf-8"?>
<OneOffixxConnectBatch xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schema.oneoffixx.com/OneOffixxConnectBatch/1">
<Entries>
<OneOffixxConnect>
<Arguments>
<LanguageLcid>1031</LanguageLcid>
<TemplateId>2e221a62-c9ec-4f4d-89d5-b0919c249867</TemplateId>
</Arguments>
<Function name="CustomInterfaceConnector" id="70E94788-CE84-4460-9698-5663878A295B">
<Arguments>
<Interface Name="ContosoInterface">
<Node Id="ContosoInterface.CompanyName">Example company</Node>
<Node Id="ContosoInterface.CompanyDivision">HR</Node>
</Interface>
</Arguments>
</Function>
</OneOffixxConnect>
</Entries>
</OneOffixxConnectBatch>
XPath
It is also possible to work with XPaths to use the interface definition. With the help of XPaths it is possible to navigate within an XML document.
If the following Connect XML is given:
<?xml version="1.0" encoding="utf-8"?>
<OneOffixxConnectBatch xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schema.oneoffixx.com/OneOffixxConnectBatch/1">
<Entries>
<OneOffixxConnect>
<Arguments>
<LanguageLcid>1031</LanguageLcid>
<TemplateId>2e221a62-c9ec-4f4d-89d5-b0919c249867</TemplateId>
</Arguments>
<Function name="CustomInterfaceConnector" id="70E94788-CE84-4460-9698-5663878A295B">
<Arguments>
<Interface Name="ContosoInterface">
<Company>
<Name>Example company</Name>
<Division>HR</Division>
</Company>
</Interface>
</Arguments>
</Function>
</OneOffixxConnect>
</Entries>
</OneOffixxConnectBatch>
...then it can be evaluated with the following interface definition:
The Connect interface supports lists in addition to nested elements. Collections are used for this purpose.
NodeCollections
Connect is also able to work with lists, the so-called NodeCollections
. To use NodeCollections
it is mandatory to work with XPaths. For the processing of NodeCollections in the document an Extended Binding is absolutely necessary.
We extend the above example with a list of employees:
The NodeCollection
can be represented in the InterfaceDescription as follows:
Â
Â
PrimeSoft AG, Bahnhofstrasse 4, 8360 Eschlikon, Switzerland