XML Command File

The commands available in the XML Command files are a subset of Loftware commands. The following commands are available: LOGIN, LABEL, SET, PORT, PRINTER, SESSIONEND, SESSIONSTART and SESSIONPRINT. The syntax for these commands differs to some extent if they are used in an XML file.

Root element in the XML Command file is <Nice_Commands>. The next element that must follow is <Label>. This element specifies the label to be used.

To start printing the labels , there are two available methods: print labels normally using the element <Print_Job>, or print labels in a session using the element <Session_Print_Job>. You can also change the printer to which the labels are printed, and additionally set the variable value.

Sample XML Command File

The sample below serves as a structural overview of the elements and their attributes as you can use them in an XML command file.

<nice_commands>
    <label name="label1.nlbl">

        <session_print_job printer="CAB A3 203DPI" skip=0 job_name="job name 1" print_to_file="filename 1">
            <session quantity="10">
                <variable name="variable name 1" >variable value 1</variable>
            </session>
        </session_print_job>

        <print_job printer="Zebra R-402" quantity="10" skip=0 identical_copies=1 number_of_sets="1" job_name="job name 2" print_to_file="filename 2">
            <variable name="variable1" >1</variable>
            <variable name="variable2" >2</variable> 
            <variable name="variable3" >3</variable>
        </print_job>
    </label>
</nice_commands>

XML Command File Specification

This section contains description of the XML Command file structure. There are several elements that contain attributes. Some attributes are required while the others are optional. Some attributes can occupy pre-defined values only, while for the others, you can specify custom values.

  • <Nice_Commands>: This is a root element.

  • <Label>: Specifies the label file to be opened. If the label is already opened, it does not re-open. The label file must be accessible from this computer. For more information, see section Access to Network Shared Resources. This element can occur several times within the command file.

    • Name: This attribute contains label name. You can include the path along with the label name. Required.

  • <Print_Job>: The element that contains data for a single label job. This element can occur several times within the command file.

    • Printer:: Use this attribute to override the printer defined in the label. The printer must be accessible from this computer. For more information, see section Access to Network Shared Resources. Optional.

    • Quantity: Use this attribute to specify the number of labels to be printed. Possible values: numeric value, VARIABLE or UNLIMITED. For more information on parameters, see Print Label. Required.

    • Skip: Use this attribute to specify how many labels should be skipped at the beginning. This feature is useful if you print a sheet of labels to laser printer, but the sheet is partial already printed. For more information, see Print Label. Optional.

    • Job_name: Use this attribute to specify the name of your job file. The specified name is visible in the print spooler. For more information, see Set Print Job Name. Optional.

    • Print_to_file: Use this attribute to specify the file name to which you want to save the printer commands. For more information, see Redirect Printing to File. Optional.

    • Identical_copies: Use this attribute to specify the number of copies you need for each label. For more information, see Print Label. Optional.

  • <Session_Print_Job>: The element that contains commands and data for one or more sessions. The element can contain one or more <Session> elements. It considers session print rules. You can use this element several times within the command file. For available attributes, look up the attributes for the <Print_Job> element. All of them are valid, you just cannot use the quantity attribute. See the description of <Session> element to find out how to specify label quantity in session printing.

  • <Session>: The element that contains data for one session. When printing in session, all labels are encoded into a single print job and sent to the printer.

    • Quantity: Use this attribute to specify the number of printed labels. Possible values: numeric value, string VARIABLE, or string UNLIMITED. For more information on parameters, see Print Label. Required.

  • <Variable>: The element that sets the variable values on the label. This element can occur several times within the command file.

    • Name: The attribute contains the variable name. Required.

XML Schema Definition (XSD) for XML Command File

<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://tempuri.org/XMLSchema.xsd" elementFormDefault="qualified" xmlns="http://tempuri.org/XMLSchema.xsd" xmlns:mstns="http://tempuri.org/XMLSchema.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="nice_commands">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="label" maxOccurs="unbounded" minOccurs="1">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="print_job" maxOccurs="unbounded" minOccurs="0">
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element name="database" maxOccurs="unbounded" minOccurs="0">
                                            <xs:complexType>
                                                <xs:simpleContent>
                                                    <xs:extension base="xs:string">
                                                        <xs:attribute name="name" type="xs:string" use="required" />
                                                    </xs:extension>
                                                </xs:simpleContent>
                                            </xs:complexType>
                                        </xs:element>
                                        <xs:element name="table" maxOccurs="unbounded" minOccurs="0">
                                            <xs:complexType>
                                                <xs:simpleContent>
                                                    <xs:extension base="xs:string">
                                                        <xs:attribute name="name" type="xs:string" use="required" />
                                                    </xs:extension>
                                                </xs:simpleContent>
                                            </xs:complexType>
                                        </xs:element>
                                        <xs:element name="variable" maxOccurs="unbounded" minOccurs="0">
                                            <xs:complexType>
                                                <xs:simpleContent>
                                                    <xs:extension base="xs:string">   
                                                        <xs:attribute name="name" type="xs:string" use="required" />
                                                    </xs:extension>
                                                </xs:simpleContent>
                                            </xs:complexType>
                                        </xs:element>
                                    </xs:sequence>
                                    <xs:attribute name="quantity" type="xs:string" use="required" />
                                    <xs:attribute name="printer" type="xs:string" use="optional" />
                                    <xs:attribute name="skip" type="xs:integer" use="optional" />
                                    <xs:attribute name="identical_copies" type="xs:integer" use="optional" />
                                    <xs:attribute name="number_of_sets" type="xs:integer" use="optional" />
                                    <xs:attribute name="job_name" type="xs:string" use="optional" />
                                    <xs:attribute name="print_to_file" type="xs:string" use="optional" />
                                    <xs:attribute name="print_to_file_append" type="xs:boolean" use="optional" />
                                    <xs:attribute name="clear_variable_values" type="xs:boolean" use="optional" />
                                </xs:complexType>
                            </xs:element>
                            <xs:element name="session_print_job" maxOccurs="unbounded" minOccurs="0">
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element name="database" maxOccurs="unbounded" minOccurs="0">
                                            <xs:complexType>
                                                <xs:simpleContent>
                                                    <xs:extension base="xs:string">       
                                                        <xs:attribute name="name" type="xs:string" use="required" />
                                                    </xs:extension>
                                                </xs:simpleContent>
                                            </xs:complexType>
                                        </xs:element>
                                        <xs:element name="table" maxOccurs="unbounded" minOccurs="0">
                                            <xs:complexType>
                                                <xs:simpleContent>
                                                    <xs:extension base="xs:string">
                                                        <xs:attribute name="name" type="xs:string" use="required" />
                                                    </xs:extension>
                                                </xs:simpleContent>
                                            </xs:complexType>
                                        </xs:element>
                                        <xs:element name="session" minOccurs="1" maxOccurs="unbounded">
                                            <xs:complexType>
                                                <xs:sequence>
                                                    <xs:element name="variable" minOccurs="0" maxOccurs="unbounded">
                                                        <xs:complexType>    
                                                            <xs:simpleContent>
                                                                <xs:extension base="xs:string">
                                                                    <xs:attribute name="name" type="xs:string" use="required" />                                                                
                                                                </xs:extension>       
                                                            </xs:simpleContent>
                                                        </xs:complexType>
                                                    </xs:element>
                                                </xs:sequence>
                                                <xs:attribute name="quantity" type="xs:string" use="required" />
                                            </xs:complexType>
                                        </xs:element>
                                    </xs:sequence>
                                    <xs:attribute name="printer" type="xs:string" use="optional" />
                                    <xs:attribute name="skip" type="xs:integer" use="optional" />
                                    <xs:attribute name="job_name" type="xs:string" use="optional" />
                                    <xs:attribute name="print_to_file" type="xs:string" use="optional" />
                                    <xs:attribute name="print_to_file_append" type="xs:boolean" use="optional" />
                                    <xs:attribute name="clear_variable_values" type="xs:boolean" use="optional" />
                                </xs:complexType>
                            </xs:element>
                        </xs:sequence>
                        <xs:attribute name="name" type="xs:string" use="required" />
                        <xs:attribute name="close" type="xs:boolean" use="optional" />
                        <xs:attribute name="clear_variable_values" type="xs:boolean" use="optional" />
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
            <xs:attribute name="quit" type="xs:boolean" use="required" />
        </xs:complexType>
    </xs:element>
</xs:schema>