XSD datatype
xs:anyURI
A URI reference — validated so loosely that almost any string passes, which makes it weaker than it looks.
xs:anyURI accepts absolute URIs, relative references, and fragments. In practice the specification's requirements are so permissive that most processors accept nearly any string that has no spaces, and some accept those too.
It is a documentation aid rather than a constraint. If a value must be an absolute https URL, a pattern facet is the only thing that will enforce it.
- Lexical space
- A URI reference, per RFC 2396 as amended — in practice, almost anything.
- Derives from
- Primitive type
- Category
- Other 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.
https://example.com//relative/path#fragmenturn:isbn:0451450523not a url
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:anyURI"/>
</xs:schema>Related
- xs:stringAny sequence of legal XML characters, with whitespace preserved exactly. The only string type that does not touch your value.
- patternA regular expression the whole value must match — anchored implicitly, and in XSD's own dialect rather than PCRE.
- xs:QNameA namespace-qualified name — and the one type whose meaning depends on namespace declarations in scope, not just on the characters.
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.