Article directory
Chapter 25 Controlling mapping to XML schemas - Mapping literal attributes to XML schemas
Map text attributes to XML
pattern
This section discusses how to project literal (non-collection) properties to XML
types, as well as options that affect the XML
schema. It discusses the following:
- Default for data type classes
XSD
Type - Compiler keywords that affect architecture
- Parameters that affect the architecture
IRIS
Default for data type classes XSD
Type
If the class or class attribute is based on one of the common IRIS
data type classes, the XML
type will be automatically set according to the following table. Classes in the %xsd
package map directly to XML
types, as shown in the table.
%Library
sum %xsd
package IRIS
number arrangement type XM
category type
IRIS Class in the %xsd Package | IRIS Class in the %Library Package | XSD Type Used in Projections to XML |
---|---|---|
%xsd.anyURI |
anyURI |
|
%xsd.base64Binary |
%Binary ,%Status |
base64Binary |
%xsd.boolean |
%Boolean |
boolean |
%xsd.byte |
%TinyInt |
byte |
%xsd.date |
%Date |
date |
%xsd.dateTime |
%PosixTime ,%StringTimeStamp ,%TimeStamp |
dateTime |
%xsd.decimal |
%Currency ,%Decimal ,%Numeric |
decimal |
%xsd.double |
%Double |
double |
%xsd.float |
float |
|
%xsd.hexBinary |
hexBinary |
|
%xsd.int |
int |
|
%xsd.integer |
integer |
|
%xsd.long |
%BigIn ,%Integer |
long |
%xsd.negativeInteger |
negativeInteger |
|
%xsd.nonNegativeInteger |
nonNegativeInteger |
|
%xsd.nonPositiveInteger |
nonPositiveInteger |
|
%xsd.positiveInteger |
positiveInteger |
|
%xsd.short |
%SmallInt |
short |
%xsd.string |
%Name ,%String ,%List |
string |
%xsd.time |
%Time |
time |
%xsd.unsignedByte |
unsignedByte |
|
%xsd.unsignedInt |
unsignedInt |
|
%xsd.unsignedLong |
unsignedLong |
|
%xsd.unsignedShort |
unsignedShort |
For information about XML data types, see https://www.w3.org/TR/xmlschema-2/.
For example, consider the following class:
Class Schema.DataTypesDemo Extends (%RegisteredObject, %XML.Adaptor)
{
Parameter XMLTYPENAMESPACE="mytypes";
Property binaryprop As %xsd.base64Binary;
Property booleanprop As %Boolean;
Property dateprop As %Date;
Property datetimeprop As %TimeStamp;
Property decimalprop As %Numeric;
Property integerprop As %Integer;
Property stringprop As %String;
Property timeprop As %Time;
}
The structure of this class is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:s="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" targetNamespace="mytypes">
<complexType name="DataTypesDemo">
<sequence>
<element minOccurs="0" name="binaryprop" type="s:base64Binary"/>
<element minOccurs="0" name="booleanprop" type="s:boolean"/>
<element minOccurs="0" name="dateprop" type="s:date"/>
<element minOccurs="0" name="datetimeprop" type="s:dateTime"/>
<element minOccurs="0" name="decimalprop" type="s:decimal"/>
<element minOccurs="0" name="integerprop" type="s:long"/>
<element minOccurs="0" name="stringprop" type="s:string"/>
<element minOccurs="0" name="timeprop" type="s:time"/>
</sequence>
</complexType>
</schema>