Converting Barcodes in Excel to XML

This topic explains how to use a feature in Excel called XML mapping to convert barcodes to XML. To read more about how to map XML elements to cells in an XML map, click here. Learn more to find out how to convert Excel data to XML.

 

Show the Developer tab

Correct your data

Add the XML definition

Link your data to XML mapping

Export XML data

Show the Developer tab

To define XML mappings in Excel, you need to access the Developer tab. Follow the instructions provided here.

Correct your data

Your data must consist of two columns, one with the item number and the other with the barcode for that item. You can have more columns, but those two are the only ones needed to import the barcodes.

Add the XML definition

Excel needs to know the structure of your XML file.

 

  1. On the Developer tab, click the Source action in the XML section.

    This opens the XML Source pane.

  2. Click XML Maps. This opens up the XML Maps window.

     

  3. Click Add and locate a definition of the barcode XML file. This can be the XML file provided here or the following scheme. Click here to download the scheme.

     

    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:element name="root">
        <xs:complexType>
          <xs:sequence>
            <xs:element maxOccurs="unbounded" minOccurs="0" name="Barcode">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="ItemNo"/>
                  <xs:element name="BarcodeNo"/>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>
  4. The XML map should now appear in the XML Maps window. Click OK. Your new mapping is now visible in the XML Source pane.

Link your data to XML mapping

The last step before exporting to XML is to define which of your columns map to the corresponding XML elements.

 

  1. Select your columns.

  2. From the XML mapping pane, right-click the barcode element and select the Map element.

  3. Verify your columns and click OK.

    You can now select each element in the XML source pane and verify that they are mapped to the correct column.

Export XML data

All that is now left to do is to export the data as XML: 

 

On the Developer tab, click the Export action in the XML section. Save the file as XML and import it to LS Express.