# phpman > man > XML::Handler::CanonXMLWriter(3pm)

## NAME
    [XML::Handler::CanonXMLWriter](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AHandler%3A%3ACanonXMLWriter/markdown) - output XML in canonical XML format

## SYNOPSIS
     use [XML::Handler::CanonXMLWriter](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AHandler%3A%3ACanonXMLWriter/markdown);

     $writer = [XML::Handler::CanonXMLWriter](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AHandler%3A%3ACanonXMLWriter/markdown) OPTIONS;
     $parser->parse(Handler => $writer);

## DESCRIPTION
    "[XML::Handler::CanonXMLWriter](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AHandler%3A%3ACanonXMLWriter/markdown)" is a PerlSAX handler that will return a string or write a stream
    of canonical XML for an XML instance and it's content.

    "[XML::Handler::CanonXMLWriter](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AHandler%3A%3ACanonXMLWriter/markdown)" objects hold the options used for writing the XML objects.
    Options can be supplied when the the object is created,

        $writer = new [XML::Handler::CanonXMLWriter](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AHandler%3A%3ACanonXMLWriter/markdown) PrintComments => 1;

    or modified at any time before calling the parser's `"parse()"' method:

        $writer->{PrintComments} = 0;

## OPTIONS
    IOHandle
        IOHandle contains a handle for writing the canonical XML to. If an IOHandle is not provided,
        the canonical XML string will be returned from `"parse()"'.

    PrintComments
        By default comments are not written to the output. Setting comment to a true value will
        include comments in the output.

## AUTHOR
    Ken MacLeod, <ken@bitsko.slc.ut.us>

## SEE ALSO
### perl

    James Clark's Canonical XML definition <<http://www.jclark.com/xml/canonxml.html>>

