XSD datatype
xs:normalizedString
A string with tabs, newlines and carriage returns replaced by spaces — but not trimmed and not collapsed.
xs:normalizedString sets whiteSpace to 'replace': every tab, line feed and carriage return becomes a single space. Nothing is trimmed, and runs of spaces are left alone.
It is the halfway house almost nobody wants. If the goal is a clean identifier, xs:token collapses runs and trims as well; if the goal is preserved text, xs:string leaves it alone. normalizedString sits between and rarely matches an intent.
- Lexical space
- Any string; tab, LF and CR are replaced with spaces during validation.
- Derives from
xs:string- Category
- String types
- Facets
- length, minLength, maxLength, pattern, enumeration, whiteSpace
What validates
Every literal below is put through the schema validator on each test run, against the schema at the foot of this page.
Ada Lovelacepaddedtab here
What does not
Nothing — this type accepts any legal XML character content. That is worth knowing: it constrains nothing on its own, so any real restriction has to come from a facet.
The schema used
This is the exact schema the literals above are validated against. Paste it into the validator with one of them to see the result yourself.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="v" type="xs:normalizedString"/>
</xs:schema>Related
- xs:stringAny sequence of legal XML characters, with whitespace preserved exactly. The only string type that does not touch your value.
- xs:tokenA string trimmed of leading and trailing whitespace, with internal runs collapsed to one space. The right type for most identifiers.
- whiteSpacepreserve, replace or collapse — applied before every other facet, which is why it changes what they see.
Get started
Bring order to the XML your team can't afford to ignore.
Create a free account and get a private workspace to search, validate, diff, and monitor your XML feeds, sitemaps, schemas, and vendor integrations.