Parsing links out of XHTML documents with namespaces
josh at janrain.com
Sun Nov 27 09:21:08 PST 2005
The recent discussion about the format of the YADIS discovery document
led me to a question about parsing <link> tags out of identity pages
for OpenID. If YADIS also uses <link> tags in HTML, this question
applies there as well.
Should the <html>, <head>, or <link> tags be allowed to be namespaced?
That is, if the proper namespace for a dialect of HTML is specified,
is an OpenID compliant consumer required to recognise the tag as an
For example, is this fragment:
<xhtml:link xhtml:rel="openid.server" xhtml:href="http://openid.example.com/" />
valid for an identity URL?
The intent of the specification on this point, if I remember
correctly, was to make parsing out the server and delegate not require
an XML parser. If I understand the intent, a compliant consumer should
only accept a <link> tag inside of a <head> tag, and a <head> inside
of a <html> tag, as a rudimentary sanity check for the identity page
being in HTML format.
If YADIS uses XRD as the service discovery document, all consumers
will need to have an XML parser. If it does, then there is no burden
on the application to accept namespaced elements, relative URLs, or
entities other than <> " or & if the identity page is
XHTML. If the identity page is HTML or not valid XHTML, then I think
that the right thing to do is to fall back on the behaviour specified
by the OpenID specification.
More information about the yadis