URI parsing/resolving tests

URI parsing/resolving tests

Please send feedback to julian.reschke@gmx.de.


RFC 3986: "Uniform Resource Identifier (URI): Generic Syntax" defines not only the URI syntax, but also various operations:

  1. Parsing a string into URI components using a Regular Expression (see Appendix B). Note that this algorithm is a reformulation of what the normative ABNF defines, and as such is supposed to process valid URI references exactly as defined by the ABNF (if it does not, an erratum should be reported; see RFC Editor Errata Page for RFC 3986). Further note that the same regular Expression can be used for IRIs as well, as the delimiter characters are exactly the same.
  2. Resolving a URI reference against a base URI (see Section 5).

This document collects a set of test cases, and shows how they are parsed into components, and also how they get resolved against a set of test base URIs (to add more tests, please provide feedback!).

The algorithms are (hopefully) faithful implementations of what RFC 3986 defines, using XSLT 2.0. This page is generated from an XML source, uris.xml, transformed by Saxon using uris.xslt.

Test Cases




resolved against yields:

resolved against yields:

: // ? # / /