[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: RE: [xri] Re: XRI Res 2 WD10
From: Victor Grey [mailto:victor@idcommons.org]
Sent: Wednesday, February 22, 2006 8:32 PM
To: xri@lists.oasis-open.org
Subject: [xri] Re: XRI Res 2 WD10Below is part of an exchange that Drummond and I had, which I'm moving onto the list at his suggestion.My new comments are ## at the bottom.
Victor Grey wrote:I have a question about XML namespaces that I started trying to ask theother day, but I'm still confused over it. (And Googling the subject,it seems like a lot of other people are too.)
...namespace prefixes are, as far as I can tell, entirelyarbitrary. In other words, if I started an XRD element with:<XRD xmlns:foofoo="xri://$xrd*($v*2.0)">then the child elements would look like:< foofoo:Query>*foo</Query>
It's also logically equivalent to not prefix the namespace at all,making it the default/implicit namespace:<XRD xmlns="xri://$xrd*($v*2.0)"><Query>*foo</Query>
This is a pain to deal with when doing XPath queries, and some of theYADIS people, who I'm sure are going to be parsing XRDs with regularexpressions, will be completely screwed. Is there any way in XML tospecify that xmlns="xri://$xrd*($v*2.0)" will be the required implicitnamespace in an XRD element, producing the alternate example that I'vealso attached?
Drummond Reed answered:...my own understanding: you can always tell an XML parser toquality an element by its namespace, and if so, that will use the*fully-qualified* namespace prefix, not the temporary namespace prefix setup inside the XML document.
A full explanation of this by the fantastic James Clark is at:
http://www.jclark.com/xml/xmlns.htm
By this explanation, it is clear that all implementers can be sure they aregetting the right XRD element simply by asking for everythingfully-qualified, i.e.:
<{xri://$xrd*($v*2.0)}Query/><{xri://$xrd*($v*2.0)}Expires/><{xri://$xrd*($v*2.0)}Service/>## Yes, but this statement is followed by "The XML Namespaces Recommendation does not take this approach, because XML 1.0 parsers would not be able to handle such documents."## I tried it in Ruby's standard library XML parser (rexml), and it sorta works, maybe. Either it's flakey or my xpath expression is wrong -- I haven't played with it a lot yet.## My concern is that people are going to be building resolvers in languages like PHP4, which has only a rather brain-dead event driven XML parser, where you have to pull out the elements you're looking for with a regex or direct match. To handle arbitrary namespace prefixes in these environments, while not impossible, is going to get ugly.
## So my question to those of you who know more about XML than I do (probably everyone): is it possible to specify that the XRD namespace will be written in its implicit default (that is, unprefixed) format, xmlns="xri://$xrd*($v*2.0)", so that one can expect its child elements to be unprefixed? Or failing that, is it worthwhile to strongly recommend that XRI authority servers do it that way, so that the poor LAMP people that will (inevitably, I assure you) be trying to parse XRDs by scraping them with regexes, will be able to find the elements they're looking for with going completely mad?
=vg
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]