Back to Contents


Attributes to Customize XML Serialization

Mapping between simple 4GL and XML datatypes

The following attributes cannot have values:

Attribute Definition
XSDAnySimpleType Map 4GL String or Varchar to XML Schema simpleType.
XSDAnyType Map 4GL String or Varchar to XML Schema anyType.
XSDAnyURI Map 4GL String or Varchar to XML Schema anyURI.
XSDBase64binary Map 4GL Byte to the XML Schema base64binary.
XSDBoolean Map 4GL Int or Smallint to XML Schema boolean.
XSDByte Map 4GL Smallint to XML Schema byte.
XSDDate Map 4GL Date or Datetime to XML Schema date.
XSDDateTime Map 4GL Datetime to XML Schema dateTime.
XSDDecimal Map 4GL Decimal to XML Schema decimal.
XSDDouble Map 4GL Float to XML Schema double.
XSDDuration Map 4GL Interval to XML Schema duration.
XSDEntities Map 4GL String or VarChar to XML Schema entities.
XSDEntity Map 4GL String or VarChar to XML Schema entity.
XSDFloat Map 4GL Smallfloat to XML Schema float.
XSDGday Map 4GL Datetime to XML Schema gDay.
XSDGMonth Map 4GL Datetime to XML Schema gMonth.
XSDGMonthDay Map 4GL Datetime to XML Schema gMonthDay.
XSDGYear Map 4GL Datetime to XML Schema gYear.
XSDGYearMonth Map 4GL Datetime to XML Schema gYearMonth.
XSDHexBinary Map 4GL Byte to XML Schema hexBinary.
XSDID Map 4GL String or VarChar to XML Schema id.
XSDIDREF Map 4GL String or VarChar to XML Schema idRef.
XSDIDREFS Map 4GL String or VarChar to XML Schema idRefs.
XSDInt Map 4GL Integer to XML Schema int.
XSDInteger Map 4GL Decimal to XML Schema integer.
XSDLanguage Map 4GL String or VarChar to XML Schema language.
XSDLong Map 4GL Decimal to XML Schema long..
XSDNCName Map 4GL String or VarChar to XML Schema NCName.
XSDName Map 4GL String or VarChar to XML Schema Name.
XSDNegativeInteger Map 4GL Decimal to XML Schema negativeInteger.
XSDNMTOKEN Map 4GL String or VarChar to XML Schema NMToken.
XSDNMTOKENS Map 4GL String or VarChar to XML Schema NMTokens.
XSDNonNegativeInteger Map 4GL Decimal to XML Schema nonNegativeInteger.
XSDNonPositiveInteger Map 4GL Decimal to XML Schema nonPositiveInteger.
XSDNormalizedString Map 4GL String or VarChar to XML Schema normalizedString.
XSDNotation Not supported.
XSDPositiveInteger Map 4GL Decimal to XML Schema positiveInteger.
XSDQName Map 4GL String or VarChar to XML Schema QName.
XSDShort Map 4GL Smallint to XML Schema short.
XSDString Map 4GL String, Char, Text or VarChar to XML Schema string.
XSDTime Map 4GL Datetime to XML Schema time.
XSDToken Map 4GL String or VarChar to XML Schema token.
XSDUnsignedByte Map 4GL Smallint to XML Schema unsignedByte.
XSDUnsignedInt Map 4GL Decimal to XML Schema unsignedInt.
XSDUnsignedLong Map 4GL Decimal to XML Schema unsignedLong.
XSDUnsignedShort Map 4GL Integer to XML Schema unsignedShort.

Facet constraints between simple 4GL and XML datatypes

Following attributes are facet constraints depending on the XSD data type used on a simple 4GL variable to restrict the allowed value-space.
(Notice that some attributes are allowed only on some XSD datatypes).
Several facet constraints can be set on the same datatype, and a madatory values is expected ( for example, XSDMinLength="8")

Attribute Definition
XSDLength Define the exact number of XML character or bytes.
XSDMinLength Define the minimum number of XML character or bytes.
XSDMaxLength Define the maximum number of XML character or bytes.
XSDEnumeration Define a list of allowed values separated by the character |.
XSDWhiteSpace Perform a XML string manipulation before serialization or deserialization.
XSDPattern Define the regular expression the value has to match.
XSDMinInclusive Define the inclusive minimum value according to the datatype where it is set.
XSDMaxInclusive Define the inclusive maximum value according to the datatype where it is set.
XSDMinExclusive Define the exclusive minimum value according to the datatype where it is set.
XSDMaxExclusive Define the exclusive maximum value according to the datatype where it is set.
XSDTotalDigits Define the total number of digits.
XSDFractionDigits Define the number of digits of the fraction part.

XML Serialization Customizing

Following attributes are used to change the default the way to serialize 4GL into XML and vice-versa, some needs a mandatory value, and some don't.

The following attributes cannot have values:

Attribute Definition
XMLOptional Define whether the variable can be missing.
XMLElement Map a 4GL simple datatype to an XML Element.
XMLAttribute Map a 4GL simple datatype to an XML Attribute.
XMLBase Set the base type of an XML Schema simpleContent.
XMLAll Map a 4GL Record to an XML Schema all structure.
XMLChoice Map a 4GL Record to an XML Schema choice structure.
XMLSequence Map a 4GL Record to an XML Schema sequence structure.
XMLSimpleContent Map a 4GL Record to an XML Schema simpleContent structure.
XSComplexType Map a 4GL Record type definition to an XML Schema complexType.
XMLList Map a one-dimensional array to an XML Schema list.
XMLSelector Define which member of an XMLChoice record is selected.

Values are mandatory for the following attributes: ( for example, XMLName="myname")

Attribute Definition
XMLName Define the XML Name of a variable in an XML document.
XMLNamespace Define the XML Namespace of a variable in an XML document.
XMLType Force the XML type name of a variable.
XMLTypenamespace Force the XML type namespace of a variable.
XSTypename Define the XML Type Name of a 4GL type definition.
XSTypenamespace Define the XML Type Namespace of a 4GL type definition.
XMLElementNamespace Define the default XML namespace of all children defined as XMLElement in a Record.
XMLAttributeNamespace Define the default XML namespace of all children defined as XMLAttribute in a Record.

Default XML Mapping

 By default, GWS maps BDL variables in the input or output messages of a Genero Web Services application to their corresponding XML data types, enabling values to be passed between applications and Web Services. The XML data types conform to the standard XML Schema Definition (XSD):

Data Type of BDL variable Default XML Data Type
BYTE xsd:base64binary
CHAR xsd:string
DATE xds.date
DATETIME YEAR TO FRACTION(1-5) xsd:dateTime
DATETIME YEAR TO SECOND xsd:dateTime
DATETIME YEAR TO HOUR xsd:dateTime
DATETIME YEAR TO MINUTE xsd:dateTime
DATETIME YEAR TO YEAR xsd:gYear
DATETIME YEAR TO MONTH xsd:gYearMonth
DATETIME YEAR TO DAY xsd:date
DATETIME MONTH TO MONTH xsd:gMonth
DATETIME MONTH TO DAY xsd:gMonthDay
DATETIME DAY TO DAY xsd:gDay
DATETIME HOUR TO HOUR xsd:time
DATETIME HOUR TO MINUTE xsd:time
DATETIME HOUR TO SECOND xsd:time
DATETIME HOUR TO FRACTION(1-5) xsd:time
DECIMAL xsd:decimal
FLOAT xsd:double
INTEGER xsd:int
INTERVAL xsd:duration
SMALLFLOAT xsd:float
SMALLINT xsd:short
STRING xsd:string
TEXT xsd:string
VARCHAR xsd:string

 In addition, the Web Service Style that you use determines what default XMLName attributes are assigned to variables. 


Mapping Example

Genero version 2.0 allows you to add optional attributes to the definition of variables. These attributes can be used to map a BDL data type used in the input or output message of a Genero Web Service application to a specific XML data type, rather than using the default.  For example, BDL does not have a BOOLEAN data type. If an XML Schema boolean data type is required for an application, you can use an attribute to map a BDL SMALLINT to a boolean.

The following example uses the XSDBoolean attribute to map a BDL SMALLINT variable to an XML Schema Boolean type, and assigns an uppercase name as the XMLName attribute:

GLOBALS
  DEFINE invoice_out RECORD
      ok SMALLINT ATTRIBUTE(XSDBoolean,XMLName="OK")
    END RECORD
END GLOBALS

Note: If you assign your own XMLName attributes, be sure to respect the conventions when using the RPC Service Style.

See the Writing a GWS Server application  Tutorial for additional information about input and output messages.


XSDAnySimpleType

Map 4GL String or Varchar to XML Schema anySimpleType


XSDAnyType

Map 4GL String or Varchar to XML Schema anyType


XSDAnyURI

Map 4GL String or Varchar to XML Schema anyURI


XSDBase64binary

Map 4GL Byte to XML Schema base64binary

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 BYTE ATTRIBUTE(XSDBase64binary,XMLName="Val")
             END RECORD
<Root>
  <Val>F0FFC8D27FF001547FC219E1FFF009F0FFC8D27FF001547D</Val>
</Root>

XSDBoolean

Map 4GL Int or Smallint to XML Schema boolean

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 INTEGER ATTRIBUTE(XSDBoolean,XMLName="Val")
             END RECORD
<Root>
  <Val>true</Val>
</Root>

XSDByte

Map 4GL Smallint to XML Schema byte

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 SMALLINT ATTRIBUTE(XSDByte,XMLName="Val")
             END RECORD
<Root>
  <Val>-126</Val>
</Root>

XSDDate

Map 4GL Date or Datetime to XML Schema date

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 DATE ATTRIBUTE(XSDDate,XMLName="Val")
             END RECORD
<Root>
  <Val>2006-06-29+01:00</Val>
</Root>

XSDDateTime

Map 4GL Datetime to XML Schema dateTime

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 DATETIME ATTRIBUTE(XSDDateTime,XMLName="Val")
             END RECORD
<Root>
  <Val>2006-06-29T09:35:26.13584+01:00</Val>
</Root>

XSDDecimal

Map 4GL Decimal to XML Schema decimal

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 DECIMAL(5,3) ATTRIBUTE(XSDDecimal,XMLName="Val")
             END RECORD
<Root>
  <Val>12.345</Val>
</Root>

XSDDouble

Map 4GL Float to XML Schema double

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 FLOAT ATTRIBUTE(XSDDouble,XMLName="Val")
             END RECORD
<Root>
  <Val>12.78e-2</Val>
</Root>

XSDDuration

Map 4GL Interval to XML Schema duration

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 INTERVAL DAY TO SECOND ATTRIBUTE(XSDDuration,XMLName="Val")
             END RECORD
<Root>
  <Val>P3DT10H30M45S</Val>
</Root>

XSDEntities

Map 4GL String or VarChar to XML Schema ENTITIES


XSDEntity

Map 4GL String or VarChar to XML Schema ENTITY


XSDFloat

Map 4GL Smallfloat to XML Schema float

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 SMALLFLOAT ATTRIBUTE(XSDFloat,XMLName="Val")
             END RECORD
<Root>
  <Val>126.435</Val>
</Root>

XSDGday

Map 4GL Datetime to XML Schema gDay

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 DATETIME DAY TO DAY ATTRIBUTE(XSDGday,XMLName="Val")
             END RECORD
<Root>
  <Val>---25</Val>
</Root>

XSDGMonth

Map 4GL Datetime to XML Schema gMonth

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 DATETIME MONTH TO MONTH ATTRIBUTE(XSDGMonth,XMLName="Val")
             END RECORD
<Root>
  <Val>--12</Val>
</Root>

XSDGMonthDay

Map 4GL Datetime to XML Schema gMonthDay

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 DATETIME MONTH TO DAY ATTRIBUTE(XSDGMonthDay,XMLName="Val")
             END RECORD
<Root>
  <Val>--12-31</Val>
</Root>

XSDGYear

Map 4GL Datetime to XML Schema gYear

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 DATETIME YEAR TO YEAR ATTRIBUTE(XSDGYear,XMLName="Val")
             END RECORD
<Root>
  <Val>2006</Val>
</Root>

XSDGYearMonth

Map 4GL Datetime to XML Schema gYearMonth

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 DATETIME YEAR TO MONTH ATTRIBUTE(XSDGYearMonth,XMLName="Val")
             END RECORD
<Root>
  <Val>2006-06</Val>
</Root>

XSDHexBinary

Map 4GL Byte to XML Schema hexBinary

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 BYTE ATTRIBUTE(XSDHexBinary,XMLName="Val")
             END RECORD
<Root>
  <Val>0FB6</Val>
</Root>

XSDID

Map 4GL String or VarChar to XML Schema ID


XSDIDREF

Map 4GL String or VarChar to XML Schema IDREF


XSDIDREFS

Map 4GL String or VarChar to XML Schema IDREFS


XSDInt

Map 4GL Integer to XML Schema int

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 INTEGER ATTRIBUTE(XSDInt,XMLName="Val")
             END RECORD
<Root>
  <Val>-1258</Val>
</Root>

XSDInteger

Map 4GL Decimal to XML Schema integer

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 DECIMAL(32,0) ATTRIBUTE(XSDInteger,XMLName="Val")
             END RECORD
<Root>
  <Val>12678</Val>
</Root>

XSDLanguage

Map 4GL String or VarChar to XML Schema language


XSDLong

Map 4GL Decimal to XML Schema long

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 DECIMAL(19,0) ATTRIBUTE(XSDLong,XMLName="Val")
             END RECORD
<Root>
  <Val>1267488</Val>
</Root>

XSDNCName

Map 4GL String or VarChar to XML Schema NCName


XSDName

Map 4GL String or VarChar to XML Schema Name


XSDNegativeInteger

Map 4GL Decimal to XML Schema negativeInteger

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 DECIMAL(32,0) ATTRIBUTE(XSDNegativeInteger,XMLName="Val")
             END RECORD
<Root>
  <Val>-4828</Val>
</Root>

XSDNMTOKEN

Map 4GL String or VarChar to XML Schema NMToken


XSDNMTOKENS

Map 4GL String or VarChar to XML Schema NMTokens


XSDNonNegativeInteger

Map 4GL Decimal to XML Schema nonNegativeInteger

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 DECIMAL(32,0) ATTRIBUTE(XSDNonNegativeInteger,XMLName="Val")
             END RECORD
<Root>
  <Val>1589</Val>
</Root>

XSDNonPositiveInteger

Map 4GL Decimal to XML Schema nonPositiveInteger

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 DECIMAL(32,0) ATTRIBUTE(XSDNonPositiveInteger,XMLName="Val")
             END RECORD
<Root>
  <Val>-8574</Val>
</Root>

XSDNormalizedString

Map 4GL String or VarChar to XML Schema normalizedString


XSDnotation

Not supported


XSDPositiveInteger

Map 4GL Decimal to XML Schema positiveInteger

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 DECIMAL(32,0) ATTRIBUTE(XSDPositiveInteger,XMLName="Val")
             END RECORD
<Root>
  <Val>+41893</Val>
</Root>

XSDQName

Map 4GL String or VarChar to XML Schema QName


XSDShort

Map 4GL Smallint to XML Schema short

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 SMALLINT ATTRIBUTE(XSDShort,XMLName="Val")
             END RECORD
<Root>
  <Val>12678</Val>
</Root>

XSDString

Map 4GL String, Char, Text of VarChar to XML Schema string

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 STRING ATTRIBUTE(XSDString,XMLName="Val")
             END RECORD
<Root>
  <Val>Hello world, how are you ?</Val>
</Root>

XSDTime

Map 4GL Datetime to XML Schema time

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 DATETIME ATTRIBUTE(XSDTime,XMLName="Val")
             END RECORD
<Root>
  <Val>23:16:03.589+01:00</Val>
</Root>

XSDToken

Map 4GL String or VarChar to XML Schema token


XSDUnsignedByte

Map 4GL Smallint to XML Schema unsignedByte

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 SMALLINT ATTRIBUTE(XSDUnsignedByte,XMLName="Val")
             END RECORD
<Root>
  <Val>254</Val>
</Root>

XSDUnsignedInt

Map 4GL Decimal to XML Schema unsignedInt

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 DECIMAL(32,0) ATTRIBUTE(XSDUnsignedInt,XMLName="Val")
             END RECORD
<Root>
  <Val>1267896754</Val>
</Root>

XSDUnsignedLong

Map 4GL Decimal to XML Schema unsignedLong

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 DECIMAL(32,0) ATTRIBUTE(XSDUnsignedLong,XMLName="Val")
             END RECORD
<Root>
  <Val>12678967543233</Val>
</Root>

 XSDUnsignedShort

Map 4GL Integer to XML Schema unsignedShort

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 INTEGER ATTRIBUTE(XSDUnsignedShort,XMLName="Val")
             END RECORD
<Root>
  <Val>65535</Val>
</Root>

XMLOptional

Define whether the variable can be missing or not. It specifies how a 4GL NULL value is interpreted in XML.

 NOTE 1 : the attribute cannot be set on a type definition
 NOTE 2 : the attribute cannot be set if the main variable is not a RECORD

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 INTEGER ATTRIBUTE(XSDint,XMLName="ValOne")
              val2 FLOAT ATTRIBUTE(XSDdouble,XMLName="ValTwo",XMLOptional)
             END RECORD
<Root>
  <ValOne>458</ValOne>
  <ValTwo>58.48</ValTwo>
</Root>
<Root>
  <ValOne>458</ValOne>
</Root>

XMLElement (Optional)

Map a 4GL simple datatype to an XML Element.

 NOTE : the attribute cannot be set on a type definition.

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 INTEGER ATTRIBUTE(XMLElement,XSDunsignedShort,XMLName="Val1")
              rec RECORD ATTRIBUTE(XMLName="Rec")
              	val2	FLOAT 	ATTRIBUTE(XMLElement,XMLName="Val2"),
              	val3	STRING	ATTRIBUTE(XMLElement,XMLName="Val3")
              	  END RECORD
             END RECORD
<Root>
  <Val1>148</Val1>
  <Rec1>
    <Val2>25.8</Val2>
    <Val3>Hello world</Val3>
  </Rec1>
</Root>

XMLAttribute

Map a 4GL simple datatype to an XML Attribute.

 NOTE 1 : the attribute cannot be set on on a type definition
 NOTE 2 : the attribute can only be set on a RECORD's member

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
              val1 INTEGER ATTRIBUTE(XMLAttribute,XSDunsignedShort,XMLName="Val1")
              rec RECORD ATTRIBUTE(XMLName="Rec")
              	val2	FLOAT 	ATTRIBUTE(XMLAttribute,XMLName="Val2"),
              	val3	STRING	ATTRIBUTE(XMLElement,XMLName="Val3")
              	  END RECORD
             END RECORD
<Root Val1="148">
  <Rec1 Val2="25.8">
    <Val3>Hello world</Val3>
  </Rec1>
</Root>

XMLBase

Define the simple 4GL variable used as the base type of an XML Schema simpleContent structure.

 NOTE : the attribute can be set on one and only one member of a RECORD defined with the XMLSimpleContent attribute


XMLAll

Map a 4GL Record to an XML Schema all structure.
The order in which the record members appear in the XML document is not significant.

Example

DEFINE myall RECORD ATTRIBUTE(XMLAll,XMLName="Root")
              val1  INTEGER ATTRIBUTE(XMLName="Val1"),
              val2  FLOAT   ATTRIBUTE(XMLAttribute,XMLName="Val2"),
              val3  STRING  ATTRIBUTE(XMLName="Val3")
             END RECORD
<Root Val2="25.8">
  <Val3>Hello world</Val3>
  <Val1>148</Val1>
</Root>
<Root Val2="25.8">
  <Val1>148</Val1>
  <Val3>Hello world</Val3>
</Root>

XMLChoice

Map a 4GL Record to an XML Schema choice structure.
The choice of the record's member is performed at runtime, and changes dynamically according to a mandatory member. This specific member must be of type SMALLINT or INTEGER, and have an XMLSelector attribute set. The XMLChoice attribute also supports a "nested" value that removes the surrounding XML tag.

 NOTE 1 : valid selector values are indexes referring to members considered as XML element nodes. All other values will raise XML runtime errors.
 NOTE 2 : nested choice records cannot be defined as main variables; there must always be a surrounding variable.

Example

DEFINE mychoice RECORD ATTRIBUTE(XMLChoice,XMLName="Root")
                val1  INTEGER   ATTRIBUTE(XMLName="Val1")
                val2  FLOAT     ATTRIBUTE(XMLAttribute,XMLName="Val2"),
                sel   SMALLINT  ATTRIBUTE(XMLSelector),
                val3  STRING    ATTRIBUTE(XMLName="Val3")
             END RECORD
Case where "sel" value is 4Case where "sel" value is 1
<Root Val2="25.8">
  <Val3>Hello world</Val3>
</Root>
<Root Val2="25.8">
  <Val1>148</Val1>
</Root>

Nested example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
                val1  INTEGER   ATTRIBUTE(XMLName="Val1")
                val2  FLOAT     ATTRIBUTE(XMLAttribute,XMLName="Val2"),
                choice RECORD   ATTRIBUTE(XMLChoice="nested")
                      choice1   INTEGER   ATTRIBUTE(XMLName="ChoiceOne"),
                      choice2   FLOAT     ATTRIBUTE(XMLName="ChoiceTwo"),
                      nestedSel SMALLINT  ATTRIBUTE(XMLSelector)
                   END RECORD,
                val3  STRING    ATTRIBUTE(XMLName="Val3")
             END RECORD
Case where "nestedSel" value is 1Case where "nestedSel" value is 2
<Root Val2="25.8">
  <Val1>148</Val1>
  <ChoiceOne>6584</ChoiceOne>
  <Val3>Hello world</Val3>
</Root>
<Root Val2="25.8">
  <Val1>148</Val1>
  <ChoiceTwo>85.8</ChoiceTwo>
  <Val3>Hello world</Val3>
</Root>

XMLSequence (Optional)

Map a 4GL Record to an XML Schema sequence structure.
The order in which the record members appear in the XML document must match the order of the 4GL Record.
The XMLSequence attribute also supports a "nested" value that removes the surrounding XML tag.

 NOTE : nested sequence records cannot be defined as main variables; there must always be a surrounding variable.

Example

DEFINE mysequence RECORD ATTRIBUTE(XMLSequence,XMLName="Root")
                val1  INTEGER   ATTRIBUTE(XMLName="Val1")
                val2  FLOAT     ATTRIBUTE(XMLAttribute,XMLName="Val2"),
                val3  STRING    ATTRIBUTE(XMLName="Val3")
             END RECORD
<Root Val2="25.8">
  <Val1>-859</Val1>
  <Val3>Hello world</Val3>
</Root>

Nested example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
                val1  INTEGER   ATTRIBUTE(XMLName="Val1")
                val2  FLOAT     ATTRIBUTE(XMLAttribute,XMLName="Val2"),
                sequence RECORD   ATTRIBUTE(XMLSequence="nested")
                      seq1   INTEGER   ATTRIBUTE(XMLName="SeqOne"),
                      seq2   FLOAT     ATTRIBUTE(XMLName="SeqTwo"),
                   END RECORD,
                val3  STRING    ATTRIBUTE(XMLName="Val3")
             END RECORD
<Root Val2="25.8">
  <Val1>148</Val1>
  <SeqOne>6584</SeqOne>
  <SeqTwo>85.597</SeqTwo>
  <Val3>Hello world</Val3>
</Root>

XMLSimpleContent

Map a 4GL Record to an XML Schema simpleContent structure.

 NOTE : one member must have the XMLBase attribute; all other members must have an XMLAttribute attribute. If not, the compiler complains.

Example

DEFINE mysimpletype RECORD ATTRIBUTE(XMLSimpleContent,XMLName="Root")
                base  STRING  ATTRIBUTE(XMLBase),
                val1  INTEGER ATTRIBUTE(XMLAttribute,XMLName="Val1"),
                val2  FLOAT   ATTRIBUTE(XMLAttribute,XMLName="Val2")
             END RECORD
<Root Val1="148" Val2="25.8">
  Hello
</Root>

XSComplexType

Map a 4GL Record type definition to an XML Schema complexType.

 NOTE : you can have one member as a nested sequence or choice, or as an XMLList array with a nested sequence or choice as the array's elements; all other members must have an XMLAttribute attribute. If not, the compiler complains.

Example

TYPE mycomplextype RECORD ATTRIBUTE(XSComplexType,XSTypeName="MyComplexType",XSTypeNamespace="http://tempuri.org")
                name DYNAMIC ARRAY ATTRIBUTE(XMLList) OF RECORD ATTRIBUTE(XMLSequence="nested")
                   firstname STRING ATTRIBUTE(XMLName="FirstName"), 
                   lastname  STRING ATTRIBUTE(XMLName="LastName")
                  END RECORD,
                date DATE ATTRIBUTE(XMLAttribute,XMLName="Date")
             END RECORD
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://tempuri.org" elementFormDefault="qualified" >
  <xsd:complexType name="MyComplexType">
    <xsd:sequence maxOccurs="unbounded">
      <xsd:element name="FirstName" type="xsd:string" />
      <xsd:element name="LastName"  type="xsd:string" />
    </xsd:sequence>
    <xsd:attribute name="Date" type="xsd:date" use="required"/>
  </xsd:complexType>
</xsd:schema>

XMLList

Map a one dimentional array to an XML Schema element that has more than one occurrence.

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
                val1  INTEGER ATTRIBUTE(XMLName="Val1"),
                list  DYNAMIC ARRAY ATTRIBUTE(XMLList) OF STRING ATTRIBUTE(XMLName="Element"),
                val2  FLOAT   ATTRIBUTE(XMLName="Val2")
             END RECORD
<Root>
  <Val1>148</Val1>
  <Element>hello</Element>
  <Element>how</Element>
  <Element>are</Element>
  <Element>you</Element>
  <Val2>0.58</Val2>
</Root>

 NOTE : it is not possible to define an XMLList attribute on a main array.


XMLSelector

Define the index of the candidate among all members of an XMLChoice record that will be serialized or de-serialized at runtime.
The index starts at 1.

 NOTE : the selector data type must be a SMALLINT or a INTEGER.


XMLName

Define the name of a variable in an XML document.

 NOTE : the attribute cannot be set on a type definition.

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root")
                val1  INTEGER ATTRIBUTE(XMLName="Val1"),
                val2  FLOAT,
                val3  INTEGER ATTRIBUTE(XMLName="Val3"),
             END RECORD
<Root>
  <Val1>148</Val1>
  <val2>0.5</val2>
  <Val3>-18547</Val3>
</Root>

XMLNamespace

Define the namespace of a variable in an XML document.

 NOTE 1 : if the attribute is set on a Record, by default all members defined as XMLElement of that record are in the same namespace.
 NOTE 2 : if the attribute is set on an Array, by default all elements defined as XMLElement of that array are in the same namespace.
 NOTE 3 : the attribute cannot be set on a type definition.

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root",XMLNamespace="http://tempuri.org")
                attr1 INTEGER ATTRIBUTE(XMLAttribute,XMLName="Attr1"),
                val1  FLOAT   ATTRIBUTE(XMLName="Val1",XMLNamespace="http://www.4js.com"),
                val2  INTEGER ATTRIBUTE(XMLName="Val2"),
                attr2 STRING ATTRIBUTE(XMLAttribute,XMLName="Attr2",XMLNamespace="http://anyuri.org"),
             END RECORD
<fjs1:Root xmlns:fjs1="http://tempuri.org" Attr1="158" xmlns:fjs3="http://anyuri.org" fjs3:Attr2="Hello">
  <fjs2:Val1 xmlns:fjs2="http://www.4js.com">0.5</fjs2:Val1>
  <fjs1:Val2>-18547</fjs1:Val2>
</fjs1:Root>

XMLType

Force the XML type name of a variable by adding xsi:type at serialization or by checking xsi:type at deserialization.

 NOTE : the attribute must be used with the XMLTypenamespace attribute; otherwise, the compiler complains.

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root",XMLNamespace="http://tempuri.org")
                val1  FLOAT   ATTRIBUTE(XMLName="Val1"),
                val2  INTEGER ATTRIBUTE(XMLName="Val2",XMLType="MyRecord",XMLTypenamespace="http://mynamespace.org")
             END RECORD
<fjs1:Root xmlns:fjs1="http://tempuri.org">
  <fjs1:Val1>0.5</fjs1:Val1>
  <fjs1:Val2 xmlns:fjs2="http://mynamespace.org" xsi:type="fjs2:MyRecord">-18547</fjs1:Val2>
</fjs1:Root>

XMLTypenamespace

Force the XML type namespace of a variable by adding xsi:type at serialization or by checking xsi:type at de-serialization.

 NOTE : the attribute must be used with the XMLType attribute; otherwise the compiler complains.

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root",XMLNamespace="http://tempuri.org")
                val1  FLOAT   ATTRIBUTE(XMLName="Val1"),
                val2  INTEGER ATTRIBUTE(XMLName="Val2",XMLType="MyRecord",XMLTypenamespace="http://mynamespace.org")
             END RECORD
<fjs1:Root xmlns:fjs1="http://tempuri.org">
  <fjs1:Val1>0.5</fjs1:Val1>
  <fjs1:Val2 xmlns:fjs2="http://mynamespace.org" xsi:type="fjs2:MyRecord">-18547</fjs1:Val2>
</fjs1:Root>

XSTypename

Define the XML Schema name of a 4GL type definition.

 NOTE 1 : the attribute must be used with the XSTypenamespace attribute; otherwise the compiler complains.
 NOTE 2 : the attribute is only allowed on a type definition.

Example

TYPE myType RECORD ATTRIBUTE(XMLSequence,XSTypeName="MyFirstType",XSTypeNamespace="http://tempuri.org")
                val1  FLOAT   ATTRIBUTE(XMLElement,XMLName="Val1"),
                val2  INTEGER ATTRIBUTE(XMLElement,XMLName="Val2",XMLOptional),
                attr  STRING  ATTRIBUTE(XMLAttribute,XMLName="Attr")
             END RECORD
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://tempuri.org" elementFormDefault="qualified" >
  <xsd:complexType name="MyFirstType">
    <xsd:sequence>
      <xsd:element name="Val1" type="xsd:double" />
      <xsd:element name="Val2" type="xsd:int" minOccurs="0" />
    </xsd:sequence>
    <xsd:attribute name="Attr" type="xsd:string" use="required" />
  </xsd:complexType>
</xsd:schema>

XSTypenamespace

Define the XML Schema namespace of a 4GL type definition.

 NOTE 1 : the attribute must be used with the XSType attribute; otherwise the compiler complains.
 NOTE 2 : the attribute is only allowed on a type definition.

Example

TYPE myType RECORD ATTRIBUTE(XMLChoice,XSTypeName="MyFirstChoice",XSTypeNamespace="http://tempuri.org")
                val1  FLOAT   ATTRIBUTE(XMLElement,XMLName="Val1"),
                val2  INTEGER ATTRIBUTE(XMLElement,XMLName="Val2",XMLOptional),
                attr  STRING  ATTRIBUTE(XMLAttribute,XMLName="Attr",XMLOptional),
                set   INTEGER ATTRIBUTE(XMLSelector)
             END RECORD
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://tempuri.org" elementFormDefault="qualified" >
  <xsd:complexType name="MyFirstChoice">
    <xsd:choice>
      <xsd:element name="Val1" type="xsd:double" />
      <xsd:element name="Val2" type="xsd:int" minOccurs="0" />
    </xsd:choice>
    <xsd:attribute name="Attr" type="xsd:string" />
  </xsd:complexType>
</xsd:schema>

XMLElementNamespace

Define the default namespace of all members of a record also defined as XML elements.

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root",XMLNamespace="http://tempuri.org",XMLElementNamespace="http://www.4js.com")
                val1  FLOAT   ATTRIBUTE(XMLElement,XMLName="Val1"),
                val2  INTEGER ATTRIBUTE(XMLElement,XMLName="Val2"),
                attr  STRING  ATTRIBUTE(XMLAttribute,XMLName="Attr"),               
             END RECORD
<fjs1:Root xmlns:fjs1="http://tempuri.org" Attr="Hello" xmlns:fjs2="http://www.4js.com">
  <fjs2:Val1>0.5</fjs2:Val1>
  <fjs2:Val2>-18547</fjs2:Val2>
</fjs1:Root>

XMLAttributeNamespace

Define the default namespace of all members of a record also defined as XML attributes.

Example

DEFINE myVar RECORD ATTRIBUTE(XMLName="Root",XMLNamespace="http://tempuri.org",XMLAttributeNamespace="http://www.4js.com")
                val1  FLOAT   ATTRIBUTE(XMLElement,XMLName="Val1"),
                val2  INTEGER ATTRIBUTE(XMLElement,XMLName="Val2"),
                attr1 STRING  ATTRIBUTE(XMLAttribute,XMLName="Attr1"),               
                attr2 DATE    ATTRIBUTE(XMLAttribute,XMLName="Attr2",XMLNamespace="http://anyuri.org"),               
             END RECORD
<fjs1:Root xmlns:fjs1="http://tempuri.org" fjs2:Attr1="Hello" xmlns:fjs2="http://www.4js.com" xmlns:fjs3="http://anyuri.org" fjs3:Attr2="2006-06-24">
  <fjs1:Val1>0.5</fjs1:Val1>
  <fjs1:Val2>-18547</fjs1:Val2>
</fjs1:Root>

XSDLength

Restrict the length of the data to the exact number of XML characters allowed when set on a 4GL STRING, VARCHAR, CHAR or TEXT, or the number of bytes allowed when set on a 4GL BYTE.

 NOTE 1 : XSDMinLength and XSDMaxLength can be used together, but XSDMaxLength value must be greater then XSDMinLength
 NOTE 2 : XSDMaxLength cannot be used with XSDLength

Examples

DEFINE myStr STRING ATTRIBUTE(XSDString,XSDLength="12",XMLName="MyString")
DEFINE myByte BYTE ATTRIBUTE(XSDBase64Binary,XSDLength="8000",XMLName="MyPicture")

XSDMinLength

Restrict the length of the data to the minimum number of XML characters allowed when set on a 4GL STRING, VARCHAR, CHAR or TEXT, or the number of bytes allowed when set on a 4GL BYTE.

 NOTE 1 : XSDMinLength and XSDMaxLength can be used together, but XSDMaxLength value must be greater then XSDMinLength
 NOTE 2 : XSDMaxLength cannot be used with XSDLength

Examples

DEFINE myStr STRING ATTRIBUTE(XSDString,XSDMinLength="12",XMLName="MyString")
DEFINE myByte BYTE ATTRIBUTE(XSDBase64Binary,XSDMinLength="8000",XMLName="MyPicture")

XSDMaxLength

Restrict the length of the data to the maximum number of XML characters allowed when set on a 4GL STRING, VARCHAR, CHAR or TEXT, or the number of bytes allowed when set on a 4GL BYTE.

 NOTE 1 : XSDMinLength and XSDMaxLength can be used together, but XSDMaxLength value must be greater then XSDMinLength
 NOTE 2 : XSDMaxLength cannot be used with XSDLength

Examples

DEFINE myStr STRING ATTRIBUTE(XSDString,XSDMaxLength="12",XMLName="MyString")
DEFINE myByte BYTE ATTRIBUTE(XSDBase64Binary,XSDMaxLength="8000",XMLName="MyPicture")

XSDEnumeration

Restrict the allowed value-space to a list of values separated by the characters |.

 NOTE 1 : To escape the separator character, simply double it like the following ||
 NOTE 2 : This attribute can be set on any simple 4GL variable excepted on XSDBoolean.

Examples

DEFINE myStr STRING ATTRIBUTE(XSDString,XSDEnumeration="one|two|three|four",XMLName="MyString")
DEFINE myDec DECIMAL(3,1) ATTRIBUTE(XSDDecimal,XSDEnumeration="12.1|11.8|-24.7",XMLName="MyDecimal")

XSDWhiteSpace

Perform a XML string manipulation before serialization or deserialization according to one of the three allowed values : preserve, replace or collapse.

 NOTE 1 : The whiteSpace facet is always performed before any other facet constraints, or serialization or deserialization process.
 NOTE 2 : For any 4GL variable excepted STRING,CHAR and VARCHAR, only collapse is allowed.

Examples

DEFINE myStr STRING ATTRIBUTE(XSDString,XSDWhiteSpace="replace",XMLName="MyString")
DEFINE myDec DECIMAL(3,1) ATTRIBUTE(XSDDecimal,XSDWhiteSpace="collapse",XMLName="MyDecimal")

XSDPattern

Define a regular expression the value has to match to be serialized or deserialized without any error.

 NOTE 1 : The regular expression is defined in the XML Schema Part 2 specification available here.
 NOTE 2 : Backslash characters '\' in a regular expression must be escaped by duplicating it.

Examples

DEFINE myStr STRING ATTRIBUTE(XSDString,XSDPattern="A.*Z",XMLName="MyString")
DEFINE myZipCode INTEGER ATTRIBUTE(XSDInt,XSDPattern="[0-9]{5}",XMLName="MyZipCode")
DEFINE myOtherZipCode INTEGER ATTRIBUTE(XSDInt,XSDPattern="\\d{5}",XMLName="myOtherZipCode") # regex is \d{5} see note

XSDMinInclusive

Define the minimum inclusive value allowed and depending on the datatype where it is set, namely all numeric, date and time datatypes.

 NOTE  : The minimum value cannot exceed the implicit minimum value supported by the datatype itself or the compiler will complain. For instance, with XSDShort the minimum value is -32768.

Examples

DEFINE myCode SMALLINT ATTRIBUTE(XSDShort,XSDMinInclusive="-1000",XMLName="MyCode")
DEFINE myRate DECIMAL(4,2) ATTRIBUTE(XSDDecimal,XSDMinInclusive="100.01",XMLName="MyRate")

XSDMaxInclusive

Define the maximum inclusive value allowed and depending on the datatype where it is set, namely all numeric, date and time datatypes.

 NOTE  : The maximum value cannot exceed the implicit maximum value supported by the datatype itself or the compiler will complain. For instance, with XSDShort the maximum value is 32767.

Examples

DEFINE myCode SMALLINT ATTRIBUTE(XSDShort,XSDMaxInclusive="1000",XMLName="MyCode")
DEFINE myRate DECIMAL(4,2) ATTRIBUTE(XSDDecimal,XSDMaxInclusive="299.99",XMLName="MyRate")

XSDMinExclusive

Define the minimum exclusive value allowed and depending on the datatype where it is set, namely all numeric, date and time datatypes.

 NOTE  : The minimum value cannot exceed or be equal to the implicit minimum value supported by the datatype itself or the compiler will complain. For instance, with XSDShort the minimum value is -32768.

Examples

DEFINE myCode SMALLINT ATTRIBUTE(XSDShort,XSDMinExclusive="-1000",XMLName="MyCode")
DEFINE myRate DECIMAL(4,2) ATTRIBUTE(XSDDecimal,XSDMinExclusive="100.01",XMLName="MyRate")

XSDMaxExclusive

Define the maximum exclusive value allowed and depending on the datatype where it is set, namely all numeric, date and time datatypes.

 NOTE  : The maximum value cannot exceed or be equal to the implicit maximum value supported by the datatype itself or the compiler will complain. For instance, with XSDShort the maximum value is 32767.

Examples

DEFINE myCode SMALLINT ATTRIBUTE(XSDShort,XSDMaxExclusive="1000",XMLName="MyCode")
DEFINE myRate DECIMAL(4,2) ATTRIBUTE(XSDDecimal,XSDMaxExclusive="299.99",XMLName="MyRate")

XSDTotalDigits

Define the maximum number of digits allowed on a numeric datatype, fraction part inclusive if there is one.

 NOTE 1 : The total digits value cannot be equal or lower then 0.
 NOTE 2 : On a 4GL decimal, the total digits value cannot be lower than the precision of the 4GL decimal itself.
 NOTE 3 : Notice that a decimal without any precision and scale value is a decimal(16), therfore the total digits value must be equal or greater than 16.

Examples

DEFINE myCode SMALLINT ATTRIBUTE(XSDShort,XSDTotalDigits="4",XSDMaxExclusive="1000",XMLName="MyCode")
DEFINE myRate DECIMAL(4,2) ATTRIBUTE(XSDDecimal,XSDTotalDigits="5",XSDMaxExclusive="299.99",XMLName="MyRate")

XSDFractionDigits

Define the maximum number of digits allowed on the fraction part of a numeric datatype.

 NOTE 1 : The fraction digits value set on a 4GL datatype without XSDDecimal set, can only be 0.
 NOTE 2 : On a 4GL decimal, the fraction digits value cannot be lower than the scale of the 4GL decimal itself, and must be lower than the XSDTotalDigits value if set.

Examples

DEFINE myCode SMALLINT ATTRIBUTE(XSDShort,XSDFractionDigits="0",XSDMaxExclusive="1000",XMLName="MyCode")
DEFINE myRate DECIMAL(4,2) ATTRIBUTE(XSDDecimal,XSDTotalDigits="5",XSDFractionDigits="3",XSDMaxExclusive="299.99",XMLName="MyRate")