XML technologies / XML Schema / Data type reference / xs:string

(Excerpt from “XML Schema” by Eric van der Vlist)

Arbitrary strings

Derived from: xs:anySimpleType

Primitive type: xs:string

Known subtypes: xs:normalizedString

Facets: xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace

Definition

<xs:simpleType name="string" id="string">
    <xs:restriction base="xs:anySimpleType">
        <xs:whiteSpace value="preserve"/>
    </xs:restriction>
</xs:simpleType>

Description

The lexical and value spaces of xs:string consist of all possible strings composed of characters permitted in XML 1.0 documents. No processing of whitespace takes place.

Restrictions

This is the only data type preserving all whitespace characters. If whitespace is insignificant, xs:token is preferred.

Example

The value of the following element:

<title lang="de">
  Auf den
  Hund gekommen
</title>

is the complete string

Auf den Hund gekommen

Including all tabs and CR/LF, if the title element has type xs:string.

   

 

 

 

back to top