XSD String Data Types

For the values containing the character strings, the string data types are used.

XSD Example:







  
    
    
    
    
  




String Data Type:

The characters, line feeds, carriage returns, and tab characters are included in the string data type. On using the string data type, the XML processor will not modify the value.

Example: String declaration in a schema:


An element in a document:

Tony Jonas

Or:

 Tony Jonas 

NormalizedString Data Type:

Derived from the String data type, the normalizedString data type also contains characters, but here, the line feeds, carriage returns, and tab characters will be removed by the XML.

Example: NormalizedString declaration in a schema:


An element in a document:

Tony Jonas

Or:

 Tony Jonas 

Explanation:

In the above example, the tabs will be replaced with spaces by the XML processor.

Token Data Type:

Derived from the String data type, the token data type also contains characters, but here, the line feeds, carriage returns, tabs, leading and trailing spaces, and multiple spaces will be removed by the XML processor.

Example: Token declaration in a schema:


An element in a document:

Tony Jonas

Or:

 Tony Jonas 

Explanation:

In the above example, the tabs will be removed by the XML processor.

String Data Types:

Except for string itself, all the data types mentioned below are derived from the String data type.

Name Uses
ENTITIES
ENTITY
ID Used to specify a string that represents the ID attribute in XML. Only used with schema attributes.
IDREF Used to specify a string that represents the IDREF attribute in XML. Only used with schema attributes.
IDREFS
language Used to specify a string that contains a valid language id.
Name Used to specify a string that contains a valid XML name.
NCName
NMTOKEN Used to specify a string that represents the NMTOKEN attribute in XML. Only used with schema attributes.
NMTOKENS
normalizedString Used to specify a string that does not contain line feeds, carriage returns, or tabs.
QName
string Used to specify a string.
token Used to specify a string that does not contain line feeds, carriage returns, tabs, leading or trailing spaces, or multiple spaces.

Restrictions on String Data Types:

Restrictions used with String data types:

  • enumeration
  • length
  • maxLength
  • minLength
  • pattern (NMTOKENS, IDREFS, and ENTITIES cannot use this constraint)
  • whiteSpace
Please follow and like us:
Content Protection by DMCA.com