# phpman > info > XML::Handler::BuildDOM

[XML::Handler::BuildDOMUser](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AHandler%3A%3ABuildDOMUser/markdown))Contributed Perl [DocumenXML::Handler](https://www.chedong.com/phpMan.php/perldoc/DocumenXML%3A%3AHandler/markdown)::[BuildDOM(3pm)](https://www.chedong.com/phpMan.php/man/BuildDOM/3pm/markdown)

NAME
       [XML::Handler::BuildDOM](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AHandler%3A%3ABuildDOM/markdown) - PerlSAX handler that creates [XML::DOM](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3ADOM/markdown) document
       structures

SYNOPSIS
        use [XML::Handler::BuildDOM](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AHandler%3A%3ABuildDOM/markdown);
        use [XML::Parser::PerlSAX](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AParser%3A%3APerlSAX/markdown);

        my $handler = new [XML::Handler::BuildDOM](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AHandler%3A%3ABuildDOM/markdown) (KeepCDATA => 1);
        my $parser = new [XML::Parser::PerlSAX](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AParser%3A%3APerlSAX/markdown) (Handler => $handler);

        my $doc = $parser->parsefile ("file.xml");

DESCRIPTION
       [XML::Handler::BuildDOM](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AHandler%3A%3ABuildDOM/markdown) creates [XML::DOM](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3ADOM/markdown) document structures (i.e.
       [XML::DOM::Document](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3ADOM%3A%3ADocument/markdown)) from PerlSAX events.

       This class used to be called [XML::PerlSAX::DOM](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3APerlSAX%3A%3ADOM/markdown) prior to libxml-enno
       1.0.1.

   CONSTRUCTOR OPTIONS
       The [XML::Handler::BuildDOM](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AHandler%3A%3ABuildDOM/markdown) constructor supports the following options:

       o   KeepCDATA => 1

           If set to 0 (default), CDATASections will be converted to regular
           text.

       o   Document => $doc

           If undefined, start_document will extract it from Element or
           DocType (if set), otherwise it will create a new
           [XML::DOM::Document](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3ADOM%3A%3ADocument/markdown).

       o   Element => $elem

           If undefined, it is set to Document. This will be the insertion
           point (or parent) for the nodes defined by the following callbacks.

       o   DocType => $doctype

           If undefined, start_document will extract it from Document (if
           possible).  Otherwise it adds a new [XML::DOM::DocumentType](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3ADOM%3A%3ADocumentType/markdown) to the
           Document.

perl v5.30.0                      2019-11-24       [XML::Handler](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AHandler/markdown)::[BuildDOM(3pm)](https://www.chedong.com/phpMan.php/man/BuildDOM/3pm/markdown)
