NAME
XML::Filter::GenericChunk - Base Class for SAX Filters parsing WellBallanced Chunks
SYNOPSIS
use XML::Filter::GenericChunk;
DESCRIPTION
XML::Filter::GenericChunk is inherited by XML::SAX::Base. XML::Filter::GenericChunk itself is an abstract class, therefore as a filter it will not result any useful output. If you need a simple Chunk filter for your SAX pipeline, check XML::Filter::CharacterChunk which is shipped with this module.
The Constructor
new() is the constructor of this class. It takes three extra parameter:
- TagName
-
This expects an array reference with the TagNames the filter should handle.
- RelaxedNames
-
Relaxed name handling is an extra feature. RelaxedNames is a boolean switch, that allows one to filter all tags of a certain name - independant of the Namespace they belong to. This may is useful, but also dangerous, too. By default, strict namespace handling is activated.
- NamespaceURI
-
If only a certain namespace should be filtered, this parameter allows to specify the NamespaceURI. If NamespaceURI is omited, the qualifing name is tested (prefix and local name), otherwise only the local name will be tested.
Methods
- add_data
-
This function is very important. It helps to collect the chunk until it is really processed. It takes an array of string, that are added to the chunk.
- flush_chunk
-
As the central feature method flush_chunk will process the chunk that was set through add_data to the filter. The chunk will cause the filter to generate the appropiate SAX events as it would be processed by a XML parser.
If the chunk is not wellballanced, this function will die(). Therefore make shure it is wrapped into an eval block. In any case the currently stored chunk will be removed from the filter. Because of this flush_chunk should only be called if the chunk should contain a valid chunk.
- get_data
-
simply returns the data collected by add_data() as a string value.
- reset_data
-
removes all data collected until this point.
- get_data_fragment
-
This function parses the data collected with add_data() into a document fragment. This function is internally used by flush_chunk(). It is pretty usefull, to use this function if one needs more control than flush_chunk() provides.
- is_tag
-
this function allows to test a inherited calls to find out, if the current sequence is handled by the filter.
- relaxed_names
-
This takes a boolean value in order to toggle the relax name handling after the filter creation.
- set_namespace
-
Sets/ removes the namespace uri of the filter.
- set_tagname
-
This method allows to add extra tag names to the list of tested tagnames. it expects an array instead of an array reference!
- reset_tagname
-
This helper function is used to remove all tagnames that are filtered.
Examples
TODO
AUTHOR
Christian Glahn, christian.glahn@uibk.ac.at, Innsbruck University
SEE ALSO
XML::LibXML, XML::SAX::Base, XML::Filter::CharacterChunk
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 257:
You forgot a '=back' before '=head2'