OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

xri message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: RE: [xri] Re: XRI Res 2 WD10


I think requiring that XML be in one form or another beyond what is specified in the XML specs really runs headlong into interop. Most XML libraries don't let you have this much control over the XML that is produced, for example. Inserting a requirement like this would imply extra work for a lot of folks.
 
In general, you shouldn't be parsing XML with regexes anyway as XML isn't a regular language (there's some formal description of this somewhere anyway). Besides, XML parsers are availble for practically every language out there... I think we're beyond the state where we can talk about pushing back on XML itself (though we could have earlier on, for sure).
 
I'm not answering your XML namespaces question directly - have to run to a meeting - I'll try to respond to that more directly later in email or perhaps on today's fone call.
 
    -Gabe


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 WD10

Below 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 the
other 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, entirely
arbitrary. 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 the
YADIS people, who I'm sure are going to be parsing XRDs with regular
expressions, will be completely screwed. Is there any way in XML to
specify that xmlns="xri://$xrd*($v*2.0)" will be the required implicit
namespace in an XRD element, producing the alternate example that I've
also attached?

Drummond Reed answered:
...my own understanding: you can always tell an XML parser to
quality an element by its namespace, and if so, that will use the
*fully-qualified* namespace prefix, not the temporary namespace prefix set
up 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 are
getting the right XRD element simply by asking for everything
fully-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]