NAME

XML::Compile::C14N - XML Canonicalization

SYNOPSIS

 my $schema = XML::Compile::Cache->new(...);
 my $c14n   = XML::Compile::C14N->new(schema => $schema);

DESCRIPTION

XML canonicalization is used to enforce an explicit formatting style on de XML documents. It is required to have a reproducable output when, for instance, digital signatures gets applied to parts of the document.

C14N currently has seen three versions: 1.0, 1.1, and 2.0. Versions 1.* need [C14N-EXC] version 1.0. There is no support for version 2.0 in XML::LibXML yet, so also not provided by this module.

METHODS

Constructors

XML::Compile::C14N->new(%options)

There can be more than one C14N object active in your program.

 -Option --Default
  for      undef
  schema   undef
  version  '1.1'
for => METHOD

[0.92] When a canonicallization METHOD is provided, that will be used to automatically detect the C14N version to be loaded.

schema => XML::Compile::Cache object

Add the C14N extension information to the provided schema. If not used, you have to call loadSchemas() before compiling readers and writers.

version => STRING

Explicitly state which version C14N needs to be used. C14N2 is not yet supported. If not specified, it is first attempted to derive the version from the 'for' option.

Attributes

$obj->schema()
$obj->version()

Returns the version number.

Handling

$obj->normalize($type, $node, %options)

The $type is one of the C14* constants defined in XML::Compile::C14N::Util. The $node is an XML::LibXML::Element. Returned is a normalized byte-sequence, for instance to be signed.

 -Option     --Default
  context      <created from NODE if needed>
  prefix_list  []
  xpath        undef
context => XML::LibXML::XPathContext object
prefix_list => ARRAY

Then prefixes which are to be included in normalization, only used in excludeNamespaces (EXC) normalizations.

xpath => EXPRESSION

Only normalize a subset of the document.

Internals

$obj->loadSchemas($schema)

Load the C14N schema to the global $schema, which must extend XML::Compile::Cache.

This method will be called when you provide a value for new(schema). Otherwise, you need to call this when the global $schema is known in your program.

DETAILS

References

[C14N-10] Canonical XML Version 1.0

http://www.w3.org/TR/xml-c14n, 15 March 2001

[C14N-EXC] Exclusive XML Canonicalization Version 1.0

http://www.w3.org/TR/xml-exc-c14n/, 18 July 2002

[C14N-11] Canonical XML Version 1.1

http://www.w3.org/TR/xml-c14n11/, 2 May 2008

[C14N-20] Canonical XML Version 2.0

http://www.w3.org/TR/xml-c14n2/, 24 January 2012

SEE ALSO

This module is part of XML-Compile-C14N distribution version 0.95, built on January 15, 2020. Website: http://perl.overmeer.net/xml-compile/

LICENSE

Copyrights 2011-2020 by [Mark Overmeer <markov@cpan.org>]. For other contributors see ChangeLog.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://dev.perl.org/licenses/