How to use string data type in XQuery
In this article we will discuss about how to use string data type in XQuery in XML.
The string data type are used to represents character string in xml.It is derived from data type xdt:anyAtomicType. Basically string data type are three type-
String data type contain character and tab character.
String has the following constraining facets-
- length
- minLength
- maxLength
- pattern
- enumeration
- whiteSpace
Example of string data type
<xs:element name="Productes" type="xs:string"/>
<Productes>Product1</Productes>
<Productes>Product2</Productes>
|
- NormalizedString data type
NormalizedString data type is a subset of string data type. It represents white space normalized strings. It is built-in data type derived from string data type. It remove tab character.
normalizedString has the following constraining facets-
- length
- minLength
- maxLength
- pattern
- enumeration
- whiteSpace
Example of NormalizedString data type
<xs:element name="Productes" type="xs:normalizedString"/>
<Productes>Product 1</Productes>
<Productes>Product 2</Productes>
|
Token data type also a subset of string data type and its also derived from NormalizedString data type . The xs:token data type represents a tokenized string. Derived from the xs:normalizedString data type.
Token has the following constraining facets-
- length
- minLength
- maxLength
- pattern
- enumeration
- whiteSpace
Example of Token data type
<xs:element name="Productes" type="xs:token"/>
<Productes>Product 1</Productes>
<Productes>Product 2</Productes>
|
Further Readings
You may also want to read these related articles: here
Ask Your Question
Got a programming related question? You may want to post your question here