Creating an XML integration Follow

Avatar
Samantha Petro

This articles applies to BarTender 2019 and newer.

 BarTender 2019 introduces new types of text databases including XML databases. With Designer able to read these types of databases natively, you can now use them as trigger files as well without the need of an XLST transform.

Tip: For more information about text connectors, please see Text database connection options in BarTender 2019 (video)

 This tutorial will walk you through the following:

  • Using an XML file as a database
  • Setting up an XML file integration
  • Testing and deploying your integration

Provided for you is sample data used in the tutorial. Once you've played with it, feel free to follow the same steps with your own data and labels to create an XML integration to suit your needs.

 

Creating an XML database

Here is a sample XML database for a fictional pet food company, Seagull Pet Snacks. The database contains a simple header section <HEADER> with a body of data contained in <DETAILS>.

<?xml version="1.0"?>
<LABEL>
<HEADER>
<BRAND>Seagull Pet Snacks</BRAND>
<PACKAGE>Bag</PACKAGE>
<LOCATION>Seattle</LOCATION>
<DETAILS>
<NAME>Kitty Kibble</NAME>
<TAGLINE>Delicious snacks for kitty</TAGLINE>
<FLAVOR>Salmon</FLAVOR>
</DETAILS>
</HEADER>
</LABEL>

 To create an XML database

  1. Open a text editor such as Notepad
  2. Paste the above text into your editor.
  3. Go to File > Save As and change the save type to All Files
  4. Set the name as Database.xml, for example, and save your file

 

Creating the label file

  1.  Open BarTender Designer and create a new document.
  2. When you complete the new document wizard, go to File > Database Connection Setup.
  3. Select "Create a new database connection" and click Next
  4. Select "XML File" from the list and click Next
  5. Use the Browse button to locate the file, database.xml. Select it and click Next
  6. For this tutorial, select the first option to "Automatically detect schema from XML file" and click Next
  7. The next screen will allow you to tell BarTender where the data is actually stored in your XML file

From our database in the section above, we have a header labeled <HEADER> and a section that details each record or label marked as <DETAILS>. As we only want to use the information in the DETAILS section as our database, select it from the list in the top pane as shown in the screenshot below.

XMLintegration.png

Notice how the file preview changes depending on what tag you select. The bottom pane will show you what your data looks like in a table format.  If the preview appears as tags, click the Fields tab on the right side to change to a table format.

  1. With the DETAILS tag selected in the top pane click Next
  2. This next screen will allow you to uncheck fields if you want to ignore them. For this example, we'll leave all 3 fields checked. Click Finish on the Wizard then OK on the dialog.
  3. Now that the database is connected, click on the Data Sources tab in your toolbox if it is not already selected.
  4. Click and drag all three fields onto your label
Tip: if the TAGLINE is too wide for your label, you can turn on wrapping in the text properties box under the wrapping section.
  1.  Save your label. It is now ready for use!

 

 Creating the Integration

  1. Open Integration Builder
  2. From the start screen, select "Create New Integration"
  3. Select "File" from the dialog and click OK.
  4. Under File Detection, choose your scan folder location. This is where the Integration will be picking up files.
Note: It is recommended that you choose a folder in a common location such as the C drive. Folders in My Documents or the desktop may require special permissions to access them.
  1.  Change the file pattern to *.xml, since we'll be scanning for xml files.
  2. Click on the Print Document action.
  3. On the Document tab, use the Browse button to navigate to the document you created in the previous section. Like with the scan folder, it's recommended this document be located in a centralized folder and not in My Documents.
  4. On the Print Options tab, check the box next to "Use data source" and leave the dropdown option as "Integration Input Data"
  5. Save your file. 

 

Testing and deploying the Integration

Before we deploy the integration, we'll want to test it and create some sample trigger files. The trigger files must match the same structure as the database linked to the label file. Here's some sample data for testing. This has different data than was in the label's database but the structure is the same:

<?xml version="1.0"?>
<LABEL>
<HEADER>
<BRAND>Seagull Pet Snacks</BRAND>
<PACKAGE>Box</PACKAGE>
<LOCATION>Seattle</LOCATION>
<DETAILS>
<NAME>Dog Crunchies</NAME>
<TAGLINE>Crunchy snacks for your best friend!</TAGLINE>
<FLAVOR>Duck</FLAVOR>
</DETAILS>
</HEADER>
</LABEL>
  1.  Create a sample trigger file using the data above. Ensure that the file extension is .xml as that's what the integration is expecting
  2. With the integration open, click on the Test tab.
  3. Click the green Start button on the top ribbon.
  4. Drop the file into the scan folder you set in the previous section.
  5. Integration messages will start appearing, confirming that the integration has picked up the file.
  6. Once you have a successful print, it's time to deploy.
  7. Click the Deploy tab then the green Deploy button.
  8. If you have not saved your file, you will be prompted to do so.
  9. Click the dropdown menu and select "This Computer" from the list. Click next.
  10. Select "Deploy now" then click Finish.
  11. Your integration is now deployed.

Please sign in to leave a comment.