# man > XML::Grove::AsCanonXML

## NAME
    [XML::Grove::AsCanonXML](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AGrove%3A%3AAsCanonXML/markdown) - output XML objects in canonical XML

## SYNOPSIS
     use [XML::Grove::AsCanonXML](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AGrove%3A%3AAsCanonXML/markdown);

     # Using as_canon_xml method on [XML::Grove](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AGrove/markdown) objects:
     $string = $xml_object->as_canon_xml( OPTIONS );

     # Using an [XML::Grove::AsCanonXML](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AGrove%3A%3AAsCanonXML/markdown) instance:
     $writer = [XML::Grove::AsCanonXML](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AGrove%3A%3AAsCanonXML/markdown)->new( OPTIONS );

     $string = $writer->as_canon_xml($xml_object);
     $writer->as_canon_xml($xml_object, $file_handle);

## DESCRIPTION
    "[XML::Grove::AsCanonXML](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AGrove%3A%3AAsCanonXML/markdown)" will return a string or write a stream of canonical XML for an XML
    object and it's content (if any).

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

        $writer = [XML::Grove::AsCanonXML](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AGrove%3A%3AAsCanonXML/markdown)->new( Comments => 1 );

    or modified at any time before writing an XML object by setting the option directly in the
    `$writer' hash.

## OPTIONS
    Comments
        By default comments are not written to the output. Setting comment to TRUE 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>>

