XML Canonicalization 1.0 vs 1.1 Differences

XML Canonicalization converts XML documents into a standardized physical form so that logically equivalent documents yield identical byte sequences, which is essential for XML digital signatures. While Canonicalization 1.0 (C14N 1.0) established the foundational rules for sorting attributes, standardizing whitespace, and normalizing namespaces, it introduced significant flaws when processing subdocuments and document subsets. Canonicalization 1.1 (C14N 1.1) was developed specifically to address these limitations by refining the inheritance and processing of xml:id, xml:base, and other xml: prefixed attributes without breaking existing 1.0 implementations.

Handling of xml:id Attributes

In C14N 1.0, all inherited attributes in the xml namespace are copied into the root of an extracted subdocument. This caused a critical issue with xml:id: if an ancestor element had an xml:id, extracting a child subdocument would inherit that xml:id, leading to duplicate IDs or invalid ID assignments in the canonicalized fragment.

C14N 1.1 changes this behavior by ensuring that xml:id attributes are not inherited by child elements when subsetting an XML document, preserving document validity and uniqueness.

Resolution and Inheritance of xml:base

The handling of relative URIs and xml:base attributes is one of the most prominent changes in C14N 1.1:

General xml: Attribute Inheritance

C14N 1.0 treated all xml:* attributes uniformly with a generic inheritance model. C14N 1.1 categorizes xml:* attributes into distinct groups with specific rules:

Performance and Implementation Impact

Because C14N 1.1 requires traversing ancestor trees to compute merged base URIs and selectively filter attributes, it involves slightly more processing overhead than 1.0 when canonicalizing node-sets or subdocuments. However, for full-document canonicalization where no node-subsetting is applied, C14N 1.0 and C14N 1.1 produce identical results.