XML::Handler::BuildDOM — PerlSAX handler that creates XML::DOM document structures
| Use Case | Command | Description |
|---|---|---|
| Parse XML file into DOM object | my $handler = XML::Handler::BuildDOM->new(); my $parser = XML::Parser::PerlSAX->new(Handler => $handler); my $doc = $parser->parsefile("file.xml"); |
Create a BuildDOM handler, attach to PerlSAX parser, parse a file, and get an XML::DOM::Document. |
| Keep CDATA sections as-is | my $handler = XML::Handler::BuildDOM->new(KeepCDATA => 1); |
By default CDATA is converted to text; set KeepCDATA => 1 to preserve them. |
| Use existing document/element as insertion point | my $handler = XML::Handler::BuildDOM->new(Document => $doc, Element => $elem); |
Direct SAX events into a specific DOM node or document instead of creating a new one. |
use XML::Handler::BuildDOM;
use XML::Parser::PerlSAX;
my $handler = new XML::Handler::BuildDOM (KeepCDATA => 1);
my $parser = new XML::Parser::PerlSAX (Handler => $handler);
my $doc = $parser->parsefile ("file.xml");
XML::Handler::BuildDOM creates XML::DOM document structures (i.e. XML::DOM::Document) from PerlSAX events.
This class used to be called XML::PerlSAX::DOM prior to libxml-enno 1.0.1.
The XML::Handler::BuildDOM constructor supports the following options:
start_document will extract it from Element or DocType (if set), otherwise it will create a new XML::DOM::Document.start_document will extract it from Document (if possible). Otherwise it adds a new XML::DOM::DocumentType to the Document.Generated by phpman v4.10.0-7-g98e9fd5 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-09-17 15:30 @216.73.216.188
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)