Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

xml::filter::sort::buffer(3pm) [debian man page]

XML::Filter::Sort::Buffer(3pm)				User Contributed Perl Documentation			    XML::Filter::Sort::Buffer(3pm)

NAME
XML::Filter::Sort::Buffer - Implementation class used by XML::Filter::Sort DESCRIPTION
The documentation is targetted at developers wishing to extend or replace this class. For user documentation, see XML::Filter::Sort. For an overview of the classes and methods used for buffering, see XML::Filter::Sort::BufferMgr. BUFFER LIFE CYCLE
A XML::Filter::Sort::Buffer object is created by a XML::Filter::Sort::BufferMgr object using the "new()" method. The XML::Filter::Sort object will then propagate any SAX events it receives, to the buffer object until the end of the record is reached. As each element is added to the buffer, its contents are compared to the sort key paths and the sort key values are extracted. When the end of the record is reached, the "close()" method is called. The return value from this method is the list of sort keys. The buffer manager will store the buffer until the end of the record sequence is reached. Then it will retrieve each buffer in order of the sort key values and call the buffer's "to_sax()" method to send all buffered events to the downstream handler. Following the call to "to_sax()", the buffer is discarded. No destructor method is used - everything is handled by Perl's garbage collector. DATA STRUCTURES
The buffer contains a 'tree' of SAX events. The tree is simply an array of 'nodes'. Text nodes are represented as scalars. Other nodes are represented as arrayrefs. The first element of a node array is a single character identifying the node type: e - element c - comment p - processing instruction The second element is the node data (the hash from the original SAX event). The child nodes of an element node are represented by the third element as an arrayref. For example, this XML: <person age="27"> <lastname>smith</lastname> </person> Would be buffered as this data structure: [ [ 'e', { 'Name' => 'person' 'Prefix' => '', 'LocalName' => 'person', 'NamespaceURI' => '', 'Attributes' => { '{}age' => { 'LocalName' => 'age', 'NamespaceURI' => '', 'Value' => '27', 'Prefix' => '', 'Name' => 'age' } }, }, [ " ", [ 'e', { 'Name' => 'lastname' 'Prefix' => '', 'LocalName' => 'lastname', 'NamespaceURI' => '', 'Attributes' => {}, }, [ 'smith' ] ], " ", ] ] ] COPYRIGHT
Copyright 2002 Grant McLean <grantm@cpan.org> This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.4 2005-04-20 XML::Filter::Sort::Buffer(3pm)

Check Out this Related Man Page

XML::SAX::Tap(3pm)					User Contributed Perl Documentation					XML::SAX::Tap(3pm)

NAME
XML::SAX::Tap - Tap a pipeline of SAX processors SYNOPSIS
use XML::SAX::Machines qw( Pipeline Tap ) ; my $m = Pipeline( "UpstreamFilter", Tap( "My::Reformatter", *STDERR ), "DownstreamFilter", ); my $m = Pipeline( "UpstreamFilter", Tap( "| xmllint --format -" ), "DownstreamFilter", ); DESCRIPTION
XML::SAX::Tap is a SAX machine that passes each event it receives on to a brach handler and then on down to it's main handler. This allows debugging output, logging output, validators, and other processors (and machines, of course) to be placed in a pipeline. This differs from XML::Filter::Tee, XML::Filter::SAXT and XML::SAX::Distributer in that a tap is also a pipeline; it contains the processoring that handles the tap. It's like XML::Filter::Tee in that the events are not buffered; each event is sent first to the tap, and then to the branch (this is different from XML::SAX::Dispatcher, which buffers the events). It's like XML::SAX::Pipeline in that it contains a series of processors in a pipeline; these comprise the "tapping" processors: +----------------------------------------------+ | Tap instance | | | | Intake | | +-----+ +---------+ +---------+ | upstream --+->| Tee |--->| Stage_0 |--...-->| Stage_N | | | +-----+ +---------+ +---------+ | | | | Exhaust | | +----------------------------------+--> downstream | | +----------------------------------------------+ The events are not copied, since they may be data structures that are difficult or impossibly to copy properly, like parts of a C-based DOM implementation. Events go to the tap first so that you can validate events using a tap that throws exceptions and they will be acted on before the tap's handler sees them. This machine has no "Exhaust" port (see XML::SAX::Machine for details about "Intake" and "Exhaust" ports). METHODS
new my $tap = XML::SAX::Tap->new( @tap_processors, \%options ); AUTHOR
Barrie Slaymaker <barries@slaysys.com> COPYRIGHT
Copyright 2002, Barrie Slaymaker, All Rights Reserved You may use this module under the terms of the Artistic, GNU Public, or BSD licenses, as you choose. perl v5.10.0 2009-06-11 XML::SAX::Tap(3pm)
Man Page