The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

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)
 -Option --Default
  schema   undef
  version  '1.1'
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.

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.91, built on November 26, 2012. Website: http://perl.overmeer.net/xml-compile/

Other distributions in this suite: XML::Compile, XML::Compile::SOAP, XML::Compile::SOAP12, XML::Compile::SOAP::Daemon, XML::Compile::SOAP::WSA, XML::Compile::C14N, XML::Compile::WSS, XML::Compile::WSS::Signature, XML::Compile::Tester, XML::Compile::Cache, XML::Compile::Dumper, XML::Compile::RPC, XML::Rewrite, XML::eXistDB, and XML::LibXML::Simple.

Please post questions or ideas to the mailinglist at http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/xml-compile

For live contact with other developers, visit the #xml-compile channel on irc.perl.org.

LICENSE

Copyrights 2011-2012 by [Mark Overmeer]. 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://www.perl.com/perl/misc/Artistic.html