09 XML export
The .xml renderer turns SRS results into an XML document without a template. Use it for file imports that expect a fixed XML structure, for example courier shipment files.
Execute
| HTTP | |
|---|---|
The response has content type application/xml and UTF-8 encoding. Use file_name to download it as a file:
| HTTP | |
|---|---|
Output structure
- root element - SRS
label, used as-is (falls back to the file name whenlabelis missing) - one element per result row, named after the command
- one child element per column, named after the column
nullvalues produce an empty element, for example<GROSS_WEIGHT />
Values are written in a culture-independent format:
- numbers use
.as the decimal separator - dates without time:
yyyy-MM-dd - dates with time:
yyyy-MM-ddTHH:mm:ss bitcolumns:true/false
Skipped from the output:
- columns and commands with
ex="false" - commands with
opts="server" - commands that return no rows
Tip
Element names are taken directly from the label, command and column names. Characters that are not allowed in XML names are escaped, for example a space becomes _x0020_. Use names such as DHL-SHIPMENT-IMPORT or INV_ITEM.
Nested elements
Use / in a column alias to create nested elements, the same way as SQL Server FOR XML PATH. Consecutive columns with the same parent path are written into one parent element.
With a join, every item becomes its own SHIPMENT element. To group several items under one shipment, use a txml column.
Repeated child elements
Return the child elements as XML from a subquery and declare the column with type="txml". The value is inserted as-is, without an element named after the column.
If a txml value is not valid XML, it is written as escaped text inside an element named after the column, so the document stays valid.
Multiple commands
Each command adds its rows to the same root element, in command order. Use separate commands to mix different element types in one file, for example a header and its lines.
Restrict the format
To allow only the XML export for an SRS, add a target:
| XML | |
|---|---|
See target.