XML Parser Error 'Element data is unexpected'

Description

You receive the followng error while in Design32 when using the data source 'Scripting':

Message
XML Parser Error: Element '{http://www.loftware.com/schemas}data' is unexpected according to content model of parent element '{http://www.loftware.com/schemas}field'.

Explanation

There is a "data" statement in the script being used to replace field data that does not have the "@" symbol prefix.

Example

label.fields.field.(@name == 'Barcode1').data=input2

Solution

Modify the script to have the "data" statement with the "@" prefix

Example

label.fields.field.(@name == 'Barcode1').@data=input2

To correct:

  1. Navigate to Design32 by going to Start - All Programs - Loftware Labeling - Design32.
     


  2. Once in Design32 right-click on the label design and select Find Script.
     


  3. In the scripting data source box, type in your script.  For this article the following is an example script:



  4. Once the script is complete, select the Verify Script button.
     


  5. You will get a failure in the results box. The failure reads:

     XML Parser Error: Element '{http://www.loftware.com/schemas}data' is unexpected according to content model of parent element '{http://www.loftware.com/schemas}field'.
     
  6. This error means that somewhere in the script the element 'data' is not formatted correctly.
     
  7. In the example above if you search for the word 'data' you come to the following line :
     
       label.fields.field.(@name == 'Quantity').data = String(cases * str);
     
  8. All field identifiers should start with '@' in order for Loftware's XML parser to correctly identify the field.  In the sample above you will notice that '.data' is missing the '@' symbol.
     
  9. The field should look like this:
     
     label.fields.field.(@name == 'Quantity').@data = String(cases * str);
     
  10. Once you add the '@' and test the script you will get the Script verification completed successfully message in the results box. Select OK and the script should process without errors.