XML::Filter::BufferText - Filter to put all characters() in one event https://www.cpan.org/
Go to file
2024-01-06 09:53:52 +01:00
perl-XML-Filter-BufferText.spec perl 5.16 mass rebuild [release 1.01-3mamba;Tue Nov 13 2012] 2024-01-06 09:53:52 +01:00
README.md perl 5.16 mass rebuild [release 1.01-3mamba;Tue Nov 13 2012] 2024-01-06 09:53:52 +01:00

perl-XML-Filter-BufferText

This is a very simple filter. One common cause of grief (and programmer error) is that XML parsers aren't required to provide character events in one chunk. They can, but are not forced to, and most don't. This filter does the trivial but oft-repeated task of putting all characters into a single event.

Note that this won't help you cases such as:

blah phubar

In the above case, given the interleaving comment, there will be two character() events. This may be worked around in the future if there is demand for it.

An interesting way to use this filter, instead of telling users to use it, is to return it from your handler's constructor, already configured and all. That'll make the buffering totally transparent to them (XML::SAX::Writer does that).