XMLLiterals and Exclusive XML Canonicalization

I raise a couple of issues here:

 *   Problems with @xmlns propogation to XMLLiterals given Exclusive Canonical XML rules
 *   Potential need to keep @prefix and @xmlns separate in Evaluation Context
 *   Need to keep in-scope @profiles in Evaluation Context

The Note in 7.5 step 11, establishing a current object literal, indicates that all in-scope profiles, default vocabulary, prefix mappings and namespace declarations are replicated on top-level elements within the document fragment to be serialized, with some provisions. It also is defined to be Exclusive Canonical XML. However, my reading of [1] is that only namespaces utilized by rendered nodes are emitted. Thus, any namespaces declared using @xmlns:xxx which were used only as part of an RDFa attribute would not be included in the Canonical representation.

Consider the following:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" version="XHTML+RDFa 1.1"
      xmlns:foaf="http://xmlns.com/foaf/0.1/"
      xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<head>
<title>Test 0198</title>
<base href="http://www.example.org/me" />
</head>
<body>
      <div id="mark" about="#mark" typeof="foaf:Person">
        <h2 property="foaf:name" datatype="rdf:XMLLiteral"><span
property="foaf:firstName">Mark</span> <span
property="foaf:surname">Birbeck</span></h2>
      </div>
 </body>
</html>

I believe this should generate the following:

@base <http://rdfa.digitalbazaar.com/test-suite/test-cases/xhtml11/0198.xhtml> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

<http://www.example.org/me#mark> a foaf:Person;
   foaf:firstName "Mark";
   foaf:name "<span xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:foaf=\"http://xmlns.com/foaf/0.1/\" property=\"foaf:firstName\">Mark</span> <span xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:foaf=\"http://xmlns.com/foaf/0.1/\" property=\"foaf:surname\">Birbeck</span>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral>;
   foaf:surname "Birbeck" .

But Exclusive Canonical XML would eliminate the  xmlns:foaf=\"http://xmlns.com/foaf/0.1/\"

If mappings were made using @prefix instead of @xmlns, this wouldn't be as much of an issue. However, a processor would either need to parse the contents to determine which prefix mappings are required, or output all definitions whether from @prefix or @xmlns using @prefix notation (unless ECX caused an @xmlns to be emitted). This might generate the following, instead:

@base <http://rdfa.digitalbazaar.com/test-suite/test-cases/xhtml11/0198.xhtml> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

<http://www.example.org/me#mark> a foaf:Person;
   foaf:firstName "Mark";
   foaf:name "<span xmlns=\"http://www.w3.org/1999/xhtml\" prefix=\"foaf: http://xmlns.com/foaf/0.1/\" property=\"foaf:firstName\">Mark</span> <span xmlns=\"http://www.w3.org/1999/xhtml\" prefix=\"foaf: http://xmlns.com/foaf/0.1/\" property=\"foaf:surname\">Birbeck</span>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral>;
   foaf:surname "Birbeck" .

Is there any expectation that @xmlns mappings and @prefix mappings be kept distinct? This would imply some added processing steps when maintaining Evaluation Contexts.

Same for @profile, which must be passed along. This requires that @profile entries be maintained in proper order in the Evaluation Context so that they can be passed to the XMLLiteral serialization. This implies some more exposition in the processing steps to make it clear what and how these should be handled. For example:

<div profile="a b">
  <span profile="d e" property="foo" datatype="rdf:XMLLiteral>
    <span></span>
  </span>
</div>

Would need to remember the order "d e a b" so that they would be processed in order, and generate "<span profile=\"d e a b\"></span>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral>

Gregg

[1] http://www.w3.org/TR/2002/REC-xml-exc-c14n-20020718/#sec-Specification

Received on Friday, 22 October 2010 23:53:31 UTC