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:
- Navigate to Design32 by going to Start - All Programs - Loftware Labeling - Design32.
- Once in Design32 right-click on the label design and select Find Script.
- In the scripting data source box, type in your script. For this article the following is an example script:
- Once the script is complete, select the Verify Script button.
- 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'.
- This error means that somewhere in the script the element 'data' is not formatted correctly.
- 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);
- 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.
- The field should look like this:
label.fields.field.(@name == 'Quantity').@data = String(cases * str);
- 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.
Article Number
2015012
Versions
Loftware Label A label is a design area on the computer screen where a label format is created or edited. Manager / Loftware Print Server versions 9.5.2.0 - 11.1
Environment
All Windows environments.