XML record format
The XML record format used by FICO Application Studio has the following structure: The top-level element is InputRecordList (for inputs) or ResultRecordList (for results), which always contains a single InputRecord or ResultRecord. Data comes in the form of scalars or arrays.
- Scalars are represented as values enclosed in a named element, as shown in the example below.
- Arrays are represented as a 'table' comprised of a named element which contains multiple 'rec' (_rec) elements that represent rows of the table. Each table row contains multiple elements representing individual cells. The following example has a table named 'Channels' with three columns: 'Channel', 'Cost', and 'Capacity'.
<?xml version="1.0"?> <InputRecordList xmlns="http://www.fico.com/input" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <InputRecord> <MyScalarValue>7.5</MyScalarValue> <AnotherScalar>a string value</AnotherScalar> <Channels> <Channels_rec> <Channel>1</Channel> <Cost>0.5</Cost> <Capacity>100</Capacity> </Channels_rec> <Channels_rec> <Channel>2</Channel> <Cost>1.2</Cost> <Capacity>50</Capacity> </Channels_rec> <Channels_rec> <Channel>3</Channel> <Cost>3</Cost> <Capacity>40</Capacity> </Channels_rec> </Channels> </InputRecord> </InputRecordList>
In a Mosel model, data input from such XML files needs to be preceeded by a call to appsxmlimport to register the inputs:
declarations myScalar: real ChannelCost,ChannelCapacity: array(CHANNELS: range) of real end-declarations appsxmlimport initialisations from appsxmlin("MyScalarValue") myScalar as "[](MyScalarValue)" end-initialisations initialisations from appsxmlin("Channels") [ChannelCost,ChannelCapacity] as "[](Channel,Cost,Capacity) end-initialisations
Inversely, data output from a Mosel model needs to be terminated with a call to appsxmlexport to generate the XML format data and the corresponding XSD schema definition from the output data:
declarations ResultCost,ResultCapacity: array(CHANNELS: range) of real end-declarations initialisations appsxmlout("ResultChannels") [ChannelCost,ChannelCapacity] as "[](ResultChannel,ResultCost,ResultCapacity)" end-initialisations appsxmlexport
Please note that array data needs to be specified in sparse format, that is, all indices are specified along with the value columns.
© 2001-2019 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.