xs:string

An xs:string value is a character string that may contain any character allowed by XML. The xs:string type is a primitive type from which a large number of other types are derived. It is intended to represent generic character data, and whitespace in elements of type xs:string is always preserved.

It should be noted that xs:string is not the default type for untyped values. If a value is selected from an input document with no schema, the value is given the type xs:untypedAtomic, not xs:string. But it is easy enough to cast an xs:untypedAtomic value to xs:string. In fact, you can cast a value of any type to xs:string, and you can cast an xs:string value to any type (with restrictions for xs:QName and xs:NOTATION).

Chapter 17 provides an overview of all the functions and operations on strings. All of the operations and functions that can be performed on xs:string values can also be performed on values whose types are restrictions of xs:string. This includes user-defined types that appear in a schema, as well as the built-in derived types such as xs:normalizedString, xs:language, and xs:ID.

Get XQuery now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.