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::Xalan::DocumentBuilder - Provides Perl SAX2 handlers

SYNOPSIS

  my $doc_builder = $tr->create_document_builder();
  my $parser = AnySAX2Parser->new(
      Handler => $doc_builder->get_content_handler()
  );
  $tr->transform_to_file($doc_builder, $xsl, $output);

DESCRIPTION

This class provides Perl SAX2 handlers, so an XML::Xalan::Transformer object can transform input source generated by any Perl SAX 2.0 conformant parser.

Currently it only supports content handler.

METHODS

$doc_builder->get_content_handler()

Returns an XML::Xalan::ContentHandler object.

BUGS

XML::Xalan::DocumentBuilder object is not reusable. This means the following code won't work:

 my $db = $tr->create_document_builder();
 my $ch = $db->get_content_handler();

 # any SAX2 - conformant parser:
 my $p = XML::SAX::PurePerl->new(
     Handler => $ch
 );

 # reuse the document builder:
 for (1..100) {
     $p->parse_file(IO::File->new("$_.xml"));
     my $res = $tr->transform_to_file($db, "foo.xsl", "$_.out");
 }

TODO

Implement other handlers as well.

AUTHOR

Edwin Pratomo, edpratomo@cpan.org

SEE ALSO

XML::Xalan::Transformer(3).