Skip to main content
Version: 8.1

btxml.fromXML

Parse a BTXML script from an XML string.

Syntax

system.bartender.btxml.fromJSON(json)

Parameters

TypeParameterDescription
Stringxmlan XML string of script parameters

Returns

BTXMLScript - Parsed result.

Scope

Gateway, Designer, Client, Perspective Session

Example

Parse a BTXML script from an XML string.

config = """
<XMLScript Version="2.0">
<Command Name="">
<Print JobName="Print Item Label">
<Format>C:/Path/To/File.btw</Format>
<NamedSubString Name="name">
<Value>Item Name</Value>
</NamedSubString>
<NamedSubString Name="quantity">
<Value>500</Value>
</NamedSubString>
<PrintSetup>
<Printer>MyLabelPrinter</Printer>
</PrintSetup>
</Print>
</Command>
</XMLScript>
"""
script = system.bartender.btxml.fromXML(config)
print script.toString()

Result
{
"version": "2.0",
"commands": [
{
"actions": [
{
"type": "Print",
"jobName": "Print Item Label",
"format": {
"documentPath": "C:/Path/To/File.btw"
},
"namedSubStrings": [
{
"name": "name",
"value": "Item Name"
},
{
"name": "quantity",
"value": "500"
}
],
"printSetup": {
"printer": "MyLabelPrinter"
}
}
]
}
]
}