Re: XMLLiterals and c14n

Manu Sporny wrote:
> I thought I knew what was wrong with the tests in the test suite, but
> your and Ivan's discussion has made me second guess my understanding (or
> lack thereof) of XML c14n. Could you please point out exactly what is
> wrong with the example in:
> 
> http://html5.digitalbazaar.com/specs/rdfa.html#invalid-xmlliteral-values
> 
> Both of you seem to be asserting that c14n should be applied differently
> than I understand it to the example in the HTML+RDFa draft.

I believe the example output should be:

<>
    <http://example.org/vocab#markup>
       "<rect xmlns=\"http://www.w3.org/2000/svg\" height=\"100\" 
style=\"fill:rgb(0,0,255);stroke-width:1; stroke:rgb(0,0,0)\" 
width=\"300\"></rect><rect xmlns=\"http://www.w3.org/2000/svg\" 
height=\"50\" style=\"fill:rgb(255,0,0);stroke-width:2; 
stroke:rgb(0,0,0)\" 
width=\"50\"></rect>"^^http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral

(with appropriate line-wrapping, and with the note after the example 
updated appropriately).

Since the triple is serialised as N3/Turtle, and there is no automatic 
c14n that occurs when parsing N3/Turtle, and RDF says XMLLiterals must 
be strings that are exclusive canonical XML, the string in the example 
must be exclusive canonical XML. That's basically canonical XML with all 
the redundant namespace declarations removed, and canonical XML requires 
explicit end tags and lexicographically-ordered attributes (with 
namespace declarations first), hence the changes in the example output.

(I hope I didn't make any mistakes here - I checked with some 
command-line tools and they seem to give the same output, so I think 
it's probably approximately right!)

-- 
Philip Taylor
pjt47@cam.ac.uk

Received on Wednesday, 16 September 2009 19:33:22 UTC