GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
BufferText(3) User Contributed Perl Documentation BufferText(3)

XML::Filter::BufferText - Filter to put all characters() in one event

  my $h = SomeHandler->new;
  my $f = XML::Filter::BufferText->new( Handler => $h );
  my $p = SomeParser->new( Handler => $f );
  $p->parse;

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:

  <foo> blah <!-- comment --> phubar </foo>

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).

Robin Berjon, robin@knowscape.com

Copyright (c) 2001-2002 Robin Berjon. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

XML::SAX::*, XML::Generator::*, XML::Handler::*, XML::Filter::*
2003-07-04 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.