XSD limitations
The current implementation of the XSD support is limited to tags, arrays, and attributes. Attributes are not supported as xpath expressions to locate the listener map id (for more information, see Listener XSD format).
The Transaction Server does not use an XML validating parser and will not validate the XML received against the XML Schema. Therefore, the XML must reflect the XSD structures to ensure the correct match of XML tag values to variables.
The only facet implemented is maxLength which is used to determine the size of the string in a logical variable.
XSD constructs not supported by the Transaction Server
Currently, the Transaction Server does not process and ignores the following XML Schema constructs:
- Choice
- Unless all the elements in the choice selection are strings, the XML Schema choice construct will result in an error when processing the XML.
- Array Size
- When processing arrays in the XML (for example those elements specified with a maxOccurs="unbounded"), the array size specified in the 'Rows In' field represents an upper limit on the number of array XML elements that will be handled by the trigger. If the number of rows received in the XML is less than the value specified in 'Rows In', it does not result in an error. For every XML Schema element identified with maxOccurs="unbounded", there will be an event variable (Listener Map) or input/output variable (Transport Map) created that ends with _nbrRows. It stores the actual number of rows received capped by the 'Rows In' value. You should reference this value to determine how many rows to process when assigning the listener trigger event variables or Transaction action output variables to device, local or static variables. If the array of XML elements is not present, then the corresponding _nbrRows variable will be set to 0. When working with a Transaction action input variable you can set this field to specify the number of array items that should be processed by the transport map. Set this value to 0 to indicate that you do not want to specify any to be processed.
- Namespace
- The Transaction Server XSD Schema handling is not namespace aware.
The following shows an example of the XSD constructs that are not supported by the Transaction Server:
XSD element | XSD example |
---|---|
choice | <xsd:group
name="priceGroup"> <xsd:choice id="pg.choice"> <xsd:element name="fullPrice" type="fullPriceType"/> <xsd:element name="salePrice" type="salePriceType"/> <xsd:element name="clearancePrice" type="clearancePriceType"/> <xsd:element name="freePrice" type="freePriceType"/> </xsd:choice> </xsd:group> |
Attributes | The Transaction Server supports
attributes but not the following
options on attributes: use="prohibited" is ignored. form="qualified" is ignored and is sent with the XML Schema default of form="unqualified". |
Nil and missing element handling
- If an XSD Schema defines an element with minOccurs="0" and the XML does not contain the tag, the XML is accepted but any reference to the corresponding trigger event variables will result in a -5111(Event Variable Not Defined) or a -5209(Action variable is not serviced) error. To avoid this you should test the corresponding _nbrRows variable for a value greater than 0 before accessing the corresponding trigger event or transaction action output variable.
- If the XML contains a non null empty tag (such as <tag></tag>) the value of the data mapped to a logical variable will depend on the logical variable datatype.
- a logical variable of type String will get assigned an empty string (such as "").
- a logical variable of type numeric ( INT2, INT4 etc) is rejected unless the XSD defines the element as nillable="true" and the XML element contains the "nil" attribute. For example, <tag nil="true"></tag>. In this case since null values cannot be represented in the trigger, the status code associated with the variable will be -5111 or -5209. You can use the 'Check Variable Status' action to test the status of the variable. As an alternative you can change the logical variable type to String and perform a data type conversion in trigger logic.
Error codes
A variable with an error code such as Variable Not Serviced (-5209) or Event Variable Not Defined (-5111) cannot be manipulated or assigned to another variable without generating an error in the trigger. To check a variable error code, use the trigger Check Variable Status action from the Device category.
If one element in the array has an error such as Variable Not Serviced or Event Variable Not Defined, the entire array is invalidated. If the XSD contains default or fixed values, then those are used if the element is non nillable.
Unsupported XML schema types
The following XML schema types are not supported by the Transaction Server:
- base64Binary
- hexBinary
- duration
- NOTATION
If the XSD contains elements of the above types, they must be optional or set with nillable="true" to be handled by the Transaction Server; otherwise, it is will not be possible for the Transaction Server to generate a valid XML from the transport map XSD or successfully process an incoming XML in the listener.
Data types are mapped as follows to XML Schema types:
XML schema type | Data Type |
---|---|
boolean | BOOL |
byte | INT1 |
date | TIMESTAMP |
dateTime | TIMESTAMP |
decimal | FLOAT8 |
double | FLOAT8 |
float | FLOAT4 |
gDay | UINT1 |
gMonth | UINT1 |
gMonthDay | STRING |
gYear | UINT4 |
gYearMonth | STRING |
int | INT4 |
integer | INT8 |
long | INT8 |
short | INT2 |
string | STRING |
token | STRING |
normalizedString | STRING |
language | STRING |
Time | STRING(8) |
unsignedByte | UINT1 |
unsignedInt | UINT4 |
unsignedLong | UINT8 |
unsignedShort | UINT2 |
positiveInteger | UINT8 |
negativeInteger | INT8 |
nonPositiveInteger | INT8 |
nonNegativeInteger | UINT8 |
anyURI | STRING |
QName | STRING |
NCName | STRING |
Name | STRING |