XRI's in xml namespaces

Drummond Reed drummond.reed at cordance.net
Wed Jun 14 02:49:03 UTC 2006


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 that
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 URI
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 form,
an URI-normal form, i.e., no transformation rules apply. 

An example of all of this is the XRIs used for the XML namespace attributes
in XRDS documents, e.g.:

<?xml version="1.0" encoding="UTF-8"?>
<XRDS ref="xri://=foo">
    <XRD xmlns="xri://$xrd*($v*2.0)">
        <Query>*foo</Query>
...


=Drummond 

-----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
> namespace.
> Could someone more used to XRIs confirm this?
>
> > I bring this up because .Net xml parsing converts xml namespaces to
> > Uri objects.
>
> Are you sure?
> I can't find a reference to Uri in Microsoft's docs:
> XmlNode.NamespaceURI is a string:
>
http://msdn.microsoft.com/library/FRE/cpref/html/frlrfsystemxmlxmlnodeclassn
amespaceuritopic.asp
> XmlQualifiedName.Namespace is a string:
>
http://msdn.microsoft.com/library/FRE/cpref/html/frlrfsystemxmlxmlqualifiedn
ameclassnamespacetopic.asp
> XmlReader.NamespaceURI is a string:
>
http://msdn.microsoft.com/library/FRE/cpref/html/frlrfsystemxmlxmlreaderclas
snamespaceuritopic.asp
> and finally, XmlNamedNodeMap (which is also the base class for
> XmlAttributeList) and XmlNamespaceManager use strings:
>
http://msdn.microsoft.com/library/FRE/cpref/html/frlrfsystemxmlxmlnamednodem
apclasstopic.asp
>
http://msdn.microsoft.com/library/FRE/cpref/html/frlrfsystemxmlxmlnamespacem
anagerclasstopic.asp
> and having used ILDAsm on Microsoft's XmlTextReader and XmlScanner, I
> can't find any URI parsing...
>
> --
> Thomas Broyer
>

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 mailing list