Philip,
I just updated rdfQuery to address some of the new test cases that
you've done. Thank you for taking the time to make the edge cases
explicit. The latest trunk rdfQuery output will differ from the
samples you give in some places, so just to detail them here and
explain why:
1. For 'Empty xmlns prefix', where the test case is:
<p xmlns:="http://example.org/" property=":test">Test</p>
rdfQuery ignores the bogus namespace declaration and processes :test
as a CURIE with a missing prefix, putting it in the XHTML Vocabulary
namespace:
<> <http://www.w3.org/1999/xhtml/vocab#test> "Test" .
2. For 'Underscore xmlns prefix', where the test case is:
<p xmlns:_="http://example.org/" property="_:test">Test</p>
rdfQuery retains the legal namespace declaration but because the CURIE
begins with _:, which is how blank nodes are indicated, it's
interpreted as a blank node with the id 'test'. Predicates cannot be
blank nodes in rdfQuery, so it's treated as a bogus value and ignored.
No triples are created.
3. For 'xmlns prefix 'xml' with incorrect URI', where the test case is:
<p xmlns:xml="http://example.org/" property="xml:test">Test</p>
rdfQuery ignores the bogus namespace declaration, but uses the built-
in namespace declaration for the prefix 'xml' and therefore generates
the triple:
<> <http://www.w3.org/XML/1998/namespacetest> "Test" .
4. For 'xmlns prefix 'xmlns' with correct URI', where the test case is:
<p xmlns:xmlns="http://www.w3.org/2000/xmlns/"
property="xmlns:test">Test</p>
rdfQuery ignores the bogus namespace declaration, but uses the built-
in namespace declaration for the prefix 'xmlns' and therefore
generates the triple:
<> <http://www.w3.org/2000/xmlns/test> "Test" .
Similar logic applies for 'xmlns prefix 'xmlns' with incorrect URI'.
5. The tests 'Invalid (xml URI) xmlns value' and 'Invalid (xmlns URI)
xmlns value' should now be handled correctly, producing no triples.
6. The tests around illegal values for rel and property attributes
should now be met, as your interpretation about what happens when an
attribute is present but with an illegal value matches mine.
(Previously they were failing because the values weren't recognised as
being illegal because rdfQuery wasn't strict about the syntax of
prefixes.)
7. For 'Safe CURIE containing square brackets', where the test case is:
<p xmlns:ex="http://example.org/1/" xmlns:[ex="http://example.org/
2/" about="[[ex:test]]" property="ex:test">Test</p>
rdfQuery ignores the bogus namespace declaration for the prefix '[ex'.
The about attribute contains an illegal CURIE, so is ignored for the
purpose of setting the subject. The result is:
<> <http://example.org/1/test> "Test" .
8. The language-based tests aren't met, because I'm currently at a
loss as to how to amend rdfQuery to work out whether it's being used
in an HTML or XHTML setting and therefore whether xml:lang is a lang
attribute in the XML namespace or an attribute called 'xml:lang' in no
namespace. I'm hoping that browsers will start making the .lang DOM
property available and accurate according to HTML5; then I'll be able
to just hang the logic off that.
Cheers,
Jeni
--
Jeni Tennison
http://www.jenitennison.com