XSD String
Data Type
The string data type is used for values that can contain strings.
String Data Type (String Data Type)
The string data type can contain characters, newlines, carriage returns, and tabs.
Below is an example of a string declaration in a schema:
The element in the document should look like this:
Or like this:
Note: If you use the string data type, the XML processor will not alter the values within.
NormalizedString Data Type (NormalizedString Data Type)
The NormalizedString data type is derived from the string data type.
The NormalizedString data type can also contain characters, but the XML processor will remove line breaks, carriage returns, and tabs.
Below is an example of a NormalizedString data type in a schema:
The element in the document should look like this:
Or like this:
Note: In the above example, the XML processor will replace all tabs with spaces.
Token Data Type (Token Data Type)
The Token data type is also derived from the string data type.
The Token data type can also contain characters, but the XML processor will remove line breaks, carriage returns, tabs, leading and trailing spaces, and consecutive spaces.
Below is an example of a token declaration in a schema:
The element in the document should look like this:
Or like this:
Note: In the above example, the XML parser will remove tabs.
String Data Type
Please note that all the following data types are derived from the string data type (except for the string data type itself)!
Name | Description |
---|---|
ENTITIES | |
ENTITY | |
ID | String for submitting ID attributes in XML (used only with schema attributes) |
IDREF | String for submitting IDREF attributes in XML (used only with schema attributes) |
IDREFS language | String containing a valid language id |
Name | String containing a valid XML name |
NCName | |
NMTOKEN | String for submitting NMTOKEN attributes in XML (used only with schema attributes) |
NMTOKENS | |
normalizedString | String without line breaks, carriage returns, or tabs |
QName | |
string | String |
token | String without line breaks, carriage returns, or tabs, leading or trailing spaces, or multiple consecutive spaces |
Restriction on String Data Type
Restrictions that can be used with the string data type:
enumeration
length
maxLength
minLength
pattern (NMTOKENS, IDREFS, and ENTITIES cannot use this constraint)
whiteSpace