XRI's in xml namespaces
drummond.reed at cordance.net
Wed Jun 14 21:50:02 UTC 2006
The OASIS XRI TC probably spent 100+ hours on this very topic during the
design cycle for XRI 2.0 syntax. XRI 2.0 authority syntax is very carefully
constructed to result in both legal XRIs and URIs when the XRI is
transformed into URI-normal form.
The RFC 3986 authority syntax is:
authority = [ userinfo "@" ] host [ ":" port ]
"userinfo" can be null...
userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
...which allows "@" by itself to prefix a "host" string. Thus xri://@foo is
valid as an URI because "foo" meets the reg-name part of the host
host = IP-literal / IPv4address / reg-name
reg-name = *( unreserved / pct-encoded / sub-delims )
xri://=foo is also valid because "=" is one of the sub-delims allowed in
sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
/ "*" / "+" / "," / ";" / "="
The same holds for the other XRI GCS (global context symbol) characters "+"
(for generic identifiers or "tags"), "$" (for standards-body specified
identifiers), and "!" (for persistent identifiers).
Believe me, this was discussed and hammered out down to itsy-bitsy details
(imagine devoting an entire 2-hour TC phone call to this one subject!)
That's what it takes to develop a really solid, stable syntax for abstract
identifiers (RFC 3986 - URI - and 3987 - IRI - are hard acts to follow).
For the full gory details, see the XRI Syntax 2.0 Committee Specification at
From: Dag Arneson [mailto:dag at janrain.com]
Sent: Wednesday, June 14, 2006 1:32 PM
To: Drummond Reed
Cc: 'Grant Monroe'; 'Thomas Broyer'; yadis at lists.danga.com
Subject: Re: XRI's in xml namespaces
I'm not an expert, but I'm reading RFC 3986 section 3.2, and my
impression is that XRI syntax violates the authority syntax described
there, particularly the use of the @ symbol (which is specified to
separate the user information from the host) and also the clause "URI
producers should use names that conform to the DNS syntax" for the host.
So, by my reading, in the strictest of senses "xri://=foo" and
especially "xri://@foo" are not URIs according to RFC 3986.
I don't think that this is likely to be an issue practically, but it
seems worth consideration.
Also worth noting is that if one of the slashes is dropped, they become
valid URIs with no authority, and the XRI authority becomes part of the
URI path, which has few restrictions placed on it by 3986.
Drummond Reed wrote:
> Grant, sorry, I'm a day behind on this thread, but I wanted to reinforce
> Thomas's answer:
> Yes, it is legal to use an XRI as a XML namespace attribute (or anywhere
> element or attribute in XML that uses an "anyURI" datatype). Because the
> anyURI datatype accepts either an IRI or a URI, the only requirement is
> you make sure the XRI is in either IRI-normal form or URI-normal form.
> Once transformed (as defined in the XRI spec), an XRI is just an IRI or
> so no XML or IRI/URI parsers should have any problem with it.
> Also note that many XRIs are identical in XRI-normal form, IRI-normal
> an URI-normal form, i.e., no transformation rules apply.
> An example of all of this is the XRIs used for the XML namespace
> in XRDS documents, e.g.:
> <?xml version="1.0" encoding="UTF-8"?>
> <XRDS ref="xri://=foo">
> <XRD xmlns="xri://$xrd*($v*2.0)">
> -----Original Message-----
> From: yadis-bounces at lists.danga.com [mailto:yadis-bounces at lists.danga.com]
> On Behalf Of Grant Monroe
> Sent: Monday, June 12, 2006 2:58 PM
> To: Thomas Broyer
> Cc: yadis at lists.danga.com
> Subject: Re: XRI's in xml namespaces
> On 6/12/06, Thomas Broyer <t.broyer at gmail.com> wrote:
>>2006/6/12, Grant Monroe:
>>>Is it technically valid to use an XRI in an XML namespace attribute?
>>>I was looking at the W3C recommendation on XML namespaces,
>>>http://www.w3.org/TR/xml-names11/, and it looks like the value of an
>>>XML namespace attribute must be an IRI. While there may be rules to
>>>convert XRIs to IRIs, current parsers might barf.
>>>From what I read about XRIs, if you apply escaping rules from section
>>2.3.2 (from XRI Syntax 2.0), you should have an IRI, usable as a
>>Could someone more used to XRIs confirm this?
>>>I bring this up because .Net xml parsing converts xml namespaces to
>>Are you sure?
>>I can't find a reference to Uri in Microsoft's docs:
>>XmlNode.NamespaceURI is a string:
>>XmlQualifiedName.Namespace is a string:
>>XmlReader.NamespaceURI is a string:
>>and finally, XmlNamedNodeMap (which is also the base class for
>>XmlAttributeList) and XmlNamespaceManager use strings:
>>and having used ILDAsm on Microsoft's XmlTextReader and XmlScanner, I
>>can't find any URI parsing...
> Well, it looks like I was smoking a bit of crack about the xml parser
> turning namespaces into Uri objects. .Net xml parsing works just fine.
> I had an unrelated bug that lead me to this issue. I am still a bit
> troubled by using broken XML even if it isn't an implementation
> hurdle, though.
> Grant Monroe
More information about the yadis