XML Rules Including Special Characters

Article ID: 51664786

Details


 

Topic or Information

Generating proper XML and printing special characters

Applies To

XML-Enabled Printers

Details

Included are rules for generating proper XML and for printing some XML special characters

XML Rules Including Special Characters

Rules:

  • Open and close all tags
  • Empty tags end with />
  • Elements may not overlap
  • Attribute values are quoted “
  • < and & are only used to start tags and entities
  • XML has only five predefined internal entity references:

< > & ” ’

Your XML data stream cannot contain any of the above characters sets. However, if this is part of your data element, you would need to use the following alternate values:

& use &amp;

< use &lt;

> use &gt;

 use &apos;

 use &quot;

Example:

If you need to print the following - Dr Jekyll & Mr. Hyde  - in a XML data stream. It would look like this:

<variable name="COMPANY_NAME">Dr. Jekyll &amp; Mr. Hyde</variable>

This is true for both text and barcodes. A bar code that supports the & character would also require a change to the XML data stream.

Example:

If you need to print the following - 123&456 - in a XML data stream. It would look like this:

<variable name="BARCODE_DATA">123&amp;456</variable>

 

Without all of the correct parts of the necessary XML data stream no bar code will print. & the word amp and the ; (semicolon) are all required for the bar code to print.