4.3 Other Datatypes

The datatypes in the following list are less useful in forms, except perhaps in unusual circumstances. Nevertheless, they are a part of XForms, and are included here for completeness. Besides, someone might discover new ways to use these datatypes.

xs:float

Defined in: XML Schema part 2

The datatype xs:double can do anything xs:float can do and more. If you need to capture floating point values, use xs:double.

xs:duration

Defined in: XML Schema part 2

As specified, many duration comparisons are indeterminate. For example, is a month equal to 30 days? The answer varies from month to month. Because of this, XForms suggests against using xs:duration, except as an abstract base type for xforms:dayTimeDuration and xforms:yearMonthDuration. These derived types should always be used instead of xs:duration.

"gHorribleKluge"

xs:gYearMonth, xs:gYear, xs:gMonthDay, xs:gDay, xs:gMonth
Defined in: XML Schema part 2

These datatypes, thanks to their generally awkward natures, have collectively been christened "gHorribleKluge" by folks on the xml-dev mailing list. Very few XML documents are defined using these datatypes, which use a truncated representation of the ISO 8601 representation embodied in xs:date.

xs:hexBinary

Defined in: XML Schema part 2

This type is intended to contain bytes represented as hexadecimal values. However, in cases that absolutely require binary data to be encoded inline in XML, it is better to use the more compact xs:base64Binary.

Computer-centric numbers

xs:long, xs:unsignedLong, xs:int, xs:unsignedInt, xs:short, xs:unsignedShort, xs:byte, xs:unsignedByte
Defined in: XML Schema part 2

From the perspective of someone filling out a form, the boundary conditions inherent in a computer's internal number system are irrelevant, as is the distinction between "signed" and "unsigned" numbers. Unless you are creating a form that deals with numbers that are naturally bounded by 8, 16, 32, or 64-bit representations, use xs:integer or xs:decimal.

Markup datatypes

xs:NOTATION, xs:token, xs:Name, xs:NCName, xs:NMTOKEN, xs:ID, xs:IDREF, xs:ENTITY, xs:ENTITIES, xs:QName
Defined in: XML Schema part 2

From the perspective of someone filling out a form, details of XML internals such as NMTOKENs or IDREFs shouldn't matter. Even xs:token (which should have been named xs:tokenized) allows whitespace within the value and doesn't map to anything typical users would enter in a form. Unless you are creating a form that deals directly with XML data structures, choose different datatypes.

Further, xs:NOTATION, xs:ENTITY, and xs:ENTITIES are not guaranteed to be supported at all in XForms, and thus should be studiously avoided.



XForms Essentials
Xforms Essentials
ISBN: 0596003692
EAN: 2147483647
Year: 2005
Pages: 117
Authors: Micah Dubinko

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net