The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

XML::Canonical - Perl Implementation of Canonical XML

SYNOPSIS

  use XML::Canonical;
  $canon = XML::Canonical->new(comments => 1);
  $canon_xml = $canon->canonicalize_string($xml_string);
  $canon_xml = $canon->canonicalize_document($libxml_document);

DESCRIPTION

This modules provides an implementation of Canonical XML Recommendation (Version 1, 15 March 2001). It uses XML::LibXML for its DOM tree and XPath nodes.

METHODS

$canon = XML::Canonical->new( comments => $comments );

Returns a new XML::Canonical object. If $comments is 1, then the canonical output will include comments, otherwise comments will be removed from the output.

$output = $canon->canonicalize_string( $xml_string );

Reads in an XML string and outputs its canonical form.

$output = $canon->canonicalize_document( $libxml_doc );

Reads in a XML::LibXML::Document object and returns its canonical form.

BUGS

Doesn't remove superfluous attributes begining with xml:

Doesn't check for relative namespaces.

NOTES

This module is in early alpha stage. It is suggested that you look over the source code and test cases before using the module. In addition, the API is subject to change.

This module implements the lastest w3 recommendation, located at http://www.w3.org/TR/2001/REC-xml-c14n-20010315 XML::CanonXMLWriter implements James Clark's Canonical XML definition.

Comments, suggestions, and patches welcome.

AUTHOR

T.J. Mather, <tjmather@tjmather.com>

COPYRIGHT

Copyright (c) 2001 T.J. Mather. XML::Canonical is free software; you may redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

XML::LibXML, XML::CanonXMLWriter.