^SX — Set XML Mode
Plain English
Toggles the printer's **XML-aware input parser** — when enabled, the printer accepts label data wrapped inside XML elements (rather than as raw ZPL strings) and binds the XML field values into a previously-stored ZPL template (typically loaded with `^DF`/recalled with `^XF`). This is the entry point for **integrations driven by XML label-management systems** that produce one XML document per label (or per batch) and expect the printer to resolve the document against a saved format. While XML mode is on, the printer treats incoming bytes as XML to be parsed (extracting field values into the recalled format's `^FN` placeholders) rather than as a raw ZPL command stream — turning it off restores raw-ZPL parsing. The mode is **sticky** across power cycles when committed via `^JU` and is normally enabled once during printer commissioning, not toggled per label.
When to use
When the printer is the **endpoint of an XML-based label workflow**. The most common integration targets are **SAP printing** (SAP Smart Forms / SAPscript / Adobe Forms via the SAP-to-Zebra connector that emits Zebra XML), **Loftware NiceLabel / BarTender** when configured to push XML rather than rendered ZPL, **Bartender Commander** or **Seagull JLB** outputs in XML mode, and **enterprise WMS/MES systems** (Manhattan, Oracle WMS, Infor) whose printer adapters target Zebra XML over a saved template. The host workflow is: (1) operator/print-engineer designs the label as a normal ZPL format with `^FN`-numbered fields and saves it to the printer with `^DF` — typically once, during commissioning; (2) the host application emits an XML document referencing the saved format name and listing field values; (3) with `^SX` on, the printer parses the incoming XML, recalls the format with `^XF`, fills the `^FN` slots from the XML field values, and prints. ⚠️ **Do not enable XML mode on a printer that also receives raw ZPL** from the same channel — incoming raw-ZPL bytes will be misinterpreted as malformed XML and silently rejected. Dedicate the printer (or the network port) to XML traffic, or use separate logical queues. To verify XML mode, send the host's exact XML payload and check the printer's configuration label (`^XA^HH^XZ`) — the XML mode setting is reported there.
Syntax
^SXa
Parameters
| Parameter | Description |
|---|---|
a | **XML mode toggle**: `Y` = enable XML-aware parsing (host sends XML wrapping of `^FN` field values against a recalled format), `N` = disable, restoring raw-ZPL parsing. Default: `N`. Some firmware also accepts numeric form (`1`/`0`) — check the printer's programming guide for the exact form it expects. The setting persists across the rest of the format and is committed across power cycles via `^JU`. |
Example
^XA ^SXY ^JUS ^XZ
Enable XML mode and persist the setting (`^JUS` = save current configuration). After this runs, the printer accepts XML payloads from the host that recall a previously-stored format (loaded via `^DF^FORMAT.ZPL` … `^XZ`) and bind XML element values into the format's `^FN` placeholders. Typical XML payload shape (sent over the same TCP/USB channel the printer normally listens on): `<labels _FORMAT="E:FORMAT.ZPL"><label><field name="1">12345</field><field name="2">Acme Corp</field></label></labels>` — the `name="1"` value lands in `^FN1`, `name="2"` lands in `^FN2`, and the printer renders the recalled format with those values. To return to raw-ZPL parsing later: `^XA^SXN^JUS^XZ`.