The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

XML::SAX::IncrementalBuilder::LibXML - create DOM fragments from SAX events

SYNOPSIS

   my $builder = XML::SAX::IncrementalBuilder::LibXML->new;
   my $parser = XML::LibXML->new(Handler => $builder);
   $parser->parse( ... );
   while (my $frag = $builder->get_node) {
      # do stuff
   }

DESCRIPTION

This module builds on XML::LibXML::SAX::Builder to build DOM fragments from SAX events. Instead of (or in addition to) creating a complete DOM tree, it splits up the document into chunks based on the depth they are in the tree.

METHODS

new

Creates a new object. Accepts the following parameters

godepth INT

Lets you specify up to how deep in the xml tree you want to have the elements reported. A value of 2 would report the root element, and all of its children and grandchildren. The default value for this is 1

detach BOOL

Whether to detach the elements at godepth from their parent. This is useful if you have a very large document to parse, and don't want to keep it all in memory. For example if POE::Filter::SAXBuilder is used in a jabber application, which generates a potentially endless stream of xml.

clone

creates a new instance of the Builder with the same settings.

get_node

Returns a single node from the list of nodes that have finished building.

finished_nodes

Returns the number of nodes that have been completely built.

reset

Set the Builder back to its start state

CAVEATS

You easily get segfaults if you use xpath on nodes that aren't in a document. This is a problem in XML::LibXML. Until the problem is fixed, make sure you put anything you want to run xpath on inside an XML::LibXML::Document first.

SEE ALSO

XML::Filter::DOMFilter::LibXML has similar functionality, but based on xpath expressions.

AUTHOR

Martijn van Beers <martijn@cpan.org>

LICENCE

POE::Loop::Glib is released under the GPL version 2.0 or higher. See the file LICENCE for details.