Share on Google+Share on Google+

Built-in Simple Types

Advertisement
Data types that are already defined in XML schema specification and ready to use in schema to declare elements and attributes are known as built-in data types.

Built-in Simple Types

Data types that are already defined in XML schema specification and ready to use in schema to declare elements and attributes are known as built-in data types.

XML Schema provides many built-in data types.

19 Primitive Data Types:

1. boolean
2. string
3. d
ecimal
4. d
ouble
5. f
loat
6. anyURI
7. QName
8. hexBinary
9. b
ase64Binary
10. d
uration
11. d
ate
12. t
ime
13. dateTime
14. gYear
15. gYearMonth
16. gMonth
17. gMonthDay
18. gDay
19. N
OTATION

Built-in Derived Data Types:

There are 25 other built in data types derived from primitive types.

* 12 data types are derived from the string primitive data type.

normalizedString
token
language
Name
NMTOKEN
NMTOKENS
NCName
ID
IDREF
ENTITY
IDREFS
ENTITIES


* 13 data types are derived from the decimal primitive data type

integer
nonPositiveInteger
negativeInteger
long
int
short
byte
nonNegativeInteger
unsignedLong
unsignedInt
unsignedShort
unsignedByte
positiveInteger

Defining a Simple-type Element:

Below is the part of xml:

<book-name>My XML Book</book-name>

Its equivalent schema will be as below: 

<xs:element name="book-name" type="xs:string"/>

Advertisements

Posted on: November 20, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.