Subject: RE: [Openxri-users] [xri] iquery, ifragment and xref
Wil and Harry,
Sorry for my delay on responding; lots going on as we work up to getting the XRI GRS launched next week.
Harry’s right – I didn’t understand the full extent of what Wil was originally asking. Wil, I think the disconnect is that there is an inherent assumption in XRI syntax that XRI parsers understand cross-references. To take your example:
An XRI parser should not have any problem understanding the embedded cross-reference “(xri://=foo/bar#baz)”, even though it contains a pound sign, because as soon as it sees the opening paren “(“, it should know this is the start of a cross-reference and it should ignore any other character between it and the closing paren “)”. In other words, to an XRI parser, the XRI should effectively be as transparent as:
I am pretty sure that Epok said that the XRI parser they originally contributed did not “do” cross-references completely, and maybe that’s what you are now discovering.
So for an XRI in XRI-normal form, “xri://@example*(xri://=foo/bar#baz)” does not require any escaping. The embedded cross-reference only requires escaping in conversion to IRI-normal form. However the following XRI *does* require escaping even in XRI-normal form in order for the full cross-reference (which is meant to include “)foo”) to not be ambiguous:
xri://@example*(xri://=foo/bar#baz)foo) must be escaped to…
Hope this helps,
From: Dirty Harry
I agree with Wil, that it's not section 2.3.2 we can apply to the given problem.
But section 2.2.2 says “It is important that the value of a cross-reference be syntactically unambiguous, whether it is an absolute IRI or one of the various forms of an XRI reference”. Maybe this sentence implies the escaping requirement mentionned by Drummond.
On Behalf Of Tan, William
I’m confused now. Section 2.3.2 says “To avoid this type of misinterpretation, certain characters in a cross-reference must be percent-encoded when transforming an XRI reference into IRI-normal form.” This seems to be about the rules for an XRI reference in IRI-normal form.
I’m talking about an XRI reference in XRI normal form. If I would like to embed an XRI “xri://=foo/bar#baz” in a cross reference to become:
That is legal according to the XRI syntax, but the parser (or rather the lexer component of) has a hard time recognizing the final “)” as belonging to the enclosing cross reference because when it encounters the “#”, it is consuming “ifragment” characters, which expands out to *(ipchar / “/” / “?”) in the syntax. Since “)” is part of “ipchar”, it could belong to the fragment.
The workaround I’m doing right now is to use xri-pchar instead of pchar in in iquery and ifragment, essentially creating two new productions: xri-query and xri-fragment, which is at odds with 2.2.4 and 2.2.5.