Introduction to Schema Built-in Types

Table of Contents
Source code


You can access source code from our xmlbeansxx git repository

Download


You can download xmlbeansxx from sourceforge



Copyright © 2004-2009 touk.pl
All rights reserved.

xmlbeansxx was inspired by Apache XMLBeans (developed by The Apache XML Project). This document strongly based on XMLBeans Support for Built-In Schema Types.

xmlbeansxx Support for Built-In Schema Types

Just as with types in XML schema, and in Apache XmlBeans the xmlbeans types based on schema are arranged in a hierarchy. In general, the hierarchy of xmlbeansxx types mirrors the hierarchy of the schema types themselves. XML schema types all inherit from xs:anyType (which is at the root of the hierarchy); xmlbeansxx types inherit from XmlObject.

In XML schema, xs:anyType is the root type for two type categories: built-in and user-derived. Built-in schema types are common types defined by the XML schema specification. User-derived types are those you define in your schema. This topic lists the built-in types provided with xmlbeansxx. For information about user-derived types and the C++ types generated from them, see C++ Types Generated from User-Derived Schema Types.

See the figure on Apache XmlBeans page, that illustrates the hierarchy of types, showing both built-in schema types and their XmlBeans parallels. Notice, too, that nearly all of the built-in types are also available as natural Java types. The hierarchy implemented in xmlbeansxx is exactly the same as in Apache XmlBeans. There is only one difference - Natural C++ Types are slightly different from those in Java version. But the hierarchy is the same.

As you can see from the figure on XmlBeans pages, all 46 built-in schema types are represented by an XMLBean type provided with XmlBeans. The same functionality is provided by xmlbeansxx.

When using built-in xmlbeansxx types, keep in mind that:
  • Since XmlObject corresponds to the xs:anyType, all C++ xmlbeansxx types inherit from XmlObject. Therefore all xmlbeansxx types share the XmlObject interface's ability to create an XmlCursor at the position of the object (this is not yet implemented). They can also render the XML as strings or streams.
  • Where there is a corresponding natural C++ type, the xmlbeansxx type provides a way to get the underlying XML's value as the natural type. See the table in this topic for information on how natural C++ types map to xmlbeansxx types.
  • Values assigned to built-in xmlbeansxx types are not validated in keeping with the rules of the schema type they represent. To validate the document you should parse it again. Validation during serialization or even during sets will be implemented in the future.
    The following table lists the built-in schema types, along with their xmlbeansxx and natural C++ parallels. All xmlbeansxx types are in the xmlbeansxx namespace.

C++ Types Representing Built-In Schema Types

Built-in Schema Type xmlbeansxx Type Natural C++ Type
xs:anyType XmlObject xmlbeansxx::XmlObject
xs:anySimpleType XmlAnySimpleType std::string
xs:anyURI XmlAnyURI std::string
xs:base64Binary XmlBase64Binary xmlbeansxx::Array<unsigned char>
xs:boolean XmlBoolean bool
xs:byte XmlByte unsigned char
xs:date XmlDate xmlbeansxx::Calendar
xs:dateTime XmlDateTime xmlbeansxx::Calendar
xs:decimal XmlDecimal xmlbeansxx::BigDecimal
xs:double XmlDouble double
xs:duration XmlDuration xmlbeansxx::GDuration
xs:ENTITIES XmlENTITIES std::string
xs:ENTITY XmlENTITY std::string
xs:float XmlFloat float
xs:gDay XmlGDay xmlbeansxx::Calendar
xs:gMonth XmlGMonth xmlbeansxx::Calendar
xs:gMonthDay XmlGMonthDay xmlbeansxx::Calendar
xs:gYear XmlGYear xmlbeansxx::Calendar
xs:gYearMonth XmlGYearMonth xmlbeansxx::Calendar
xs:hexBinary XmlHexBinary xmlbeansxx::Array<unsigned char>
xs:ID XmlID std::string
xs:IDREF XmlIDREF std::string
xs:IDREFS XmlIDREFS std::string
xs:int XmlInt int
xs:integer XmlInteger xmlbeansxx::BigInteger
xs:language XmlLanguage std::string
xs:long XmlLong xmlbeansxx::Long
xs:Name XmlName std::string
xs:NCName XmlNCNAME std::string
xs:negativeInteger XmlNegativeInteger xmlbeansxx::BigInteger
xs:NMTOKEN XmlNMTOKEN std::string
xs:NMTOKENS XmlNMTOKENS std::string
xs:nonNegativeInteger XmlNonNegativeInteger xmlbeansxx::BigInteger
xs:nonPositiveInteger XmlNonPositiveInteger xmlbeansxx::BigInteger
xs:normalizedString XmlNormalizedString std::string
xs:NOTATION XmlNOTATION Not supported
xs:positiveInteger XmlPositiveInteger xmlbeansxx::BigInteger
xs:QName XmlQName xmlbeansxx::QName
xs:short XmlShort short
xs:string XmlString std::string
xs:time XmlTime xmlbeansxx::Calendar
xs:token XmlToken std::string
xs:unsignedByte XmlUnsignedByte short
xs:unsignedInt XmlUnsignedInt xmlbeansxx::BigInteger
xs:unsignedLong XmlUnsignedLong xmlbeansxx::BigInteger
xs:unsignedShort XmlUnsignedShort int
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.