XML
schema element declarations can have simple or complex types. Elements with
no element content and no attributes are declared with a simple
type in the XML schema. Attribute declarations can have simple types.
In general, elements with simple types and attributes are mapped
to fields in Designer. The type of the field is determined from
the simple type value.
Built-in simple typesThe XML Schema defines a number of built-in
simple types.
The following types are mapped to a Text Field
object, which is any object with plain text content:
string
normalizedString
token
Name
NCName
QName
language
The following types are mapped to
the numeric field object:
float
double
decimal
integer
long
int
short
byte
positiveInteger
nonPositiveInteger
negativeInteger
nonNegativeInteger
unsignedLong
unsignedInt
unsignedShort
unsignedByte
The date and time types mappings
are listed in the following table:
Date and time
|
Object type
|
duration
|
Text edit field
|
dateTime
|
Date/time field. The control type is Date
and Time.
|
date
|
Date/time field. The control type is Date.
|
time
|
Date/time field. The control type is Time.
|
gYear
|
Text field with picture clause.
|
gYearMonth
|
Text field with a picture clause
|
gMonth
|
Text field with a picture clause
|
gMonthDay
|
Text field with a picture clause
|
gDay
|
Text field with a picture clause
|
The following legacy types are mapped to
the Text Field object:
ID
IDREF
IDREFS
ENTITY
ENTITIES
NMTOKEN
NMTOKENS
NOTATION
Other
types are mapped in the following table:
Other
|
Object type
|
boolean
|
Check Box
|
hexBinary
|
Static Image
|
base64Binary
|
Static Image
|
anyURI
|
Text Field
|
Restricted simple typesNew simple types can be derived from other
simple types by using XML Schema restrictions. This section describes
how these restrictions can be mapped to form designs.
- Enumeration facets
- An XML schema element or attribute declaration of any base
type that declares one or more enumerated values will generate a
drop-down list object rather than the default field for the declaration’s
base type, as shown by the following example:
<xsd:element name="Colors">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:enumeration value="red"/>
<xsd:enumeration value="green"/>
<xsd:enumeration value="blue"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:element>
The set of enumerated values
will be stored as items for the drop-down list.
- Bounds, length, and precision facets
- Whenever possible, the restriction facets that control bounds
(minInclusive, minExclusive, maxInclusive, and maxExclusive), length
(length, minLength, and maxLength), and precision (totalDigits and
fractionDigits) are mapped to properties on generated objects. Otherwise,
they are used to generate validation scripts. Here are two examples:
The maxLength facet is used to set the maxChars properties
on the text value:
<field><value><text maxChars="100"/></value></field>
The fractionDigits facet is used to set the fracDigits property
on the decimal value:
<field><value><decimal fracDigits="3"/></value></field>
List and union typesList types allow definition of types whose
values are whitespace-separated lists of single values. Elements
and attributes that have list types will be mapped to Text Field
objects.
Union types are types for which the set of allowed
values are a union of two or more other sets of values. The various
sets are not necessarily of the same base type. In general, union
types will be mapped to Text Field objects. However, in the case
where all the sets in the union are of the same type, the mapping
will be the same as for any type by using one of those sets (that
is, a union of two sets of enumerated values will generate a drop-down
list with all values from the union).
|
|
|