Skip to main content
IBM  
Shop Support Downloads
IBM Home Products Consulting Industries News About IBM
IBM developerWorks : XML : Education - Tutorials
XML Schema Infoset Model, Part 2
ZIPPDF (letter)PDF (A4)e-mail
Main menuSection menuFeedbackPreviousNext
3. Simple types
  


Primitive and derived data types page 2 of 10


There are two main kinds of data types: primitive data types and derived data types.

Primitive data types
Primitive data types are those that are not defined in terms of other data types. Since primitive data types are the basis for all other types, they cannot have element content or attributes. However, they can contain values and constraints. Primitive data types are built into XML schemas. Examples of primitive data types are string, float, decimal, anyURI, and QName.

Built-in data types:

XML Schema built-in datatypes
The above diagram is from XML Schema Part 2: Datatypes specification.

Getting access to the primitive data types (in other words, xsd:string) in the schema for schemas using the XML Schema model is done by calling the following method where rootSchema is the root schema that was created in Exercise 1: Create a root schema document.

                          
XSDSchemaImpl.getSchemaForSchema(rootSchema.getSchemaForSchemaNamespace()).
        resolveSimpleTypeDefinition(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001,"string");
                                

Derived data types
Derived data types are those that are defined in terms of other data types, which are called base types. Derived types may have attributes, and may have element or mixed content. Instances of derived types can contain any well-formed XML that is valid according to their data type definition. They may be built-in or user-derived. Base types can be primitive types or derived data types. Derived data types are created using extension and restriction facets. They can be built-in or user-derived data types.


Main menuSection menuFeedbackPreviousNext
About IBM | Privacy | Legal | Contact