Unstructured XML
Caution
Unstructured XML can only be used with the OneOffixx Client. Server-side processing via the Document Creation Server is not possible.
The specialist application provides the following XML:
<root>
<company>
<name>Contoso Ltd.</name>
<division>Sales</division>
</company>
<changedate>2019-01-01</changedate>
</root>
From this we would like to further use the content of name
and place it in the template. To do this, the next step is to transform this unstructured XML into Connect format. In this example we will create full Connect XML (not Type Data).
1. Create Connect interface definition
<CustomInterfaces>
<InterfaceDescription Name="ContosoInterface" Description="Interface Contoso">
<Node Id="ContosoInterface.CompanyName">[CompanyName placeholder]</Node>
<Node Id="ContosoInterface.CompanyDivision">[CompanyDivision placeholder]</Node>
</InterfaceDescription>
</CustomInterfaces>
2. Create XML transformation
Now we need to transform the unstructured XML into a form that fits the interface definition from the previous step. We need the following result from the transformation:
<OneOffixxConnectBatch xmlns="http://schema.oneoffixx.com/OneOffixxConnectBatch/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Settings />
<Entries>
<OneOffixxConnect>
<Arguments>
<TemplateId>804ea87d-37a4-4307-99d7-23d16032f426</TemplateId>
<LanguageLcid>2055</LanguageLcid>
</Arguments>
<Function name="CustomInterfaceConnector" id="70E94788-CE84-4460-9698-5663878A295B">
<Arguments>
<Interface Name="ContosoInterface">
<Node Id="ContosoInterface.CompanyName">Contoso Ltd.</Node>
<Node Id="ContosoInterface.CompanyDivision">Sales</Node>
</Interface>
</Arguments>
</Function>
</OneOffixxConnect>
</Entries>
</OneOffixxConnectBatch>
For this purpose, a new interface is created in the XML Transformer. In this interface, the connect frame is specified and the relevant data is extracted and transformed using XSLT and XPath.
<Configuration>
<Interfaces>
// ab hier
<Interface name="ContosoTransformerInterface" version="1.0">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<OneOffixxConnectBatch xmlns="http://schema.oneoffixx.com/OneOffixxConnectBatch/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Settings />
<Entries>
<OneOffixxConnect>
<Arguments>
<TemplateId>804ea87d-37a4-4307-99d7-23d16032f426</TemplateId>
<LanguageLcid>2055</LanguageLcid>
</Arguments>
<Function name="CustomInterfaceConnector" id="70E94788-CE84-4460-9698-5663878A295B">
<Arguments>
<Interface Name="ContosoInterface">
<Node Id="ContosoInterface.CompanyName">
<xsl:value-of select="/root/company/company" />
</Node>
<Node Id="ContosoInterface.CompanyDivision">
<xsl:value-of select="/root/company/division" />
</Node>
</Interface>
</Arguments>
</Function>
</OneOffixxConnect>
</Entries>
</OneOffixxConnectBatch>
</xsl:template>
</xsl:stylesheet>
</Interface>
</Interfaces>
</Configuration>