Import structured data via simple XML mapping
Northwest Products may select to use simple XML mapping. Their XML data could look similar to the following.
<?xml version="1.0" encoding="UTF-8"?>
<Orders xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Order.xsd">
<Order PONumber="42367">
<ShipTo>
<FirstName>Martin</FirstName>
<LastName>Janeway</LastName>
</ShipTo>
<Articles>
<Article>
<Quantity>1</Quantity>
<ItemNr>638</ItemNr>
<Description>LANG STERLING PIE SERVER</Description>
<UnitPrice>32.95</UnitPrice>
<Amount>32.95</Amount>
</Article>
</Articles>
<Subtotal>32.95</Subtotal>
<SalesTax>2.55</SalesTax>
<Shipping>5.00</Shipping>
<Total>40.50</Total>
</Order>
</Orders>
The schema file could look like this.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Orders">
<xs:complexType>
<xs:sequence>
<xs:element name="Order">
<xs:complexType>
<xs:sequence>
<xs:element name="ShipTo">
<xs:complexType>
<xs:sequence>
<xs:element name="FirstName" type="xs:string"/>
<xs:element name="LastName" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Articles">
<xs:complexType>
<xs:sequence>
<xs:element name="Article">
<xs:complexType>
<xs:sequence>
<xs:element name="Quantity" type="xs:integer"/>
<xs:element name="ItemNr" type="xs:unsignedInt"/>
<xs:element name="Description" type="xs:string"/>
<xs:element name="UnitPrice" type="xs:decimal"/>
<xs:element name="Amount" type="xs:decimal"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Subtotal" type="xs:decimal"/>
<xs:element name="SalesTax" type="xs:decimal"/>
<xs:element name="Shipping" type="xs:decimal"/>
<xs:element name="Total" type="xs:decimal"/>
</xs:sequence>
<xs:attribute name="PONumber" type="xs:int" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
- Add a new XML type "Orders" using the XML file and the schema file.
- Add a new destination, assign it to the KfxSampleXmlmappingBatch batch class, KfxSampleXmlMappingDocument document class and the KfxSampleXmlMappingForm form type. Do not forget to add a proper routing rule.
- Select "Orders" as the XML type of the destination and select simple XML mapping.
- Select to import original content (to Kofax Capture) but deactivate any conversions to TIF or PDF.
-
Create the desired mapping via MapForce and save it, and restart
KC Plug-In.
Alternatively, if you do not have MapForce, you can use the sample files from Samples\DemoMapping\SimpleMapping\SampleSimpleMapping. Click Show files for Visual Designer and copy all sample files to this folder.
The customers of Northwest Products can now send their orders in XML format via email or file interface. The structure of the XML file must match the defined Orders type. Optionally, they can attach a TIF image of the order. The Kofax Capture batch fields are populated automatically, the XML file and the (optional) TIFF image are imported as the document's pages.
With simple mapping:
-
All attachments received along with the XML files are automatically imported to Kofax Capture to the same batch/document class as pages, without being mentioned in the XSL transformation.
-
If the fields in the batch class where XML data elements are being mapped have the same names as the XML data elements, the mapping is easier.