(rough) perl sax outline filter

[ archiving this somewhere, since it's not worthy of dev.w3.org cvs- 
space yet ]
[ DISCLAIMER: This is quick and dirty]...

I wanted to play with sax filters and used a real-life case as an  
example, and since we're likely to need an outline (output of h1 to  
h6 headings) sax filter for the validator...

can be improved:
- warnings for missing steps of heading?
- other types of headings depending on document type (e.g <h> in xhtml2?

Attached is the actual sax filter module (Outline.pm) and a proof-of- 
concept script using it (outliner.pl)

Note: the (excellent otherwise) article at xml.com called  
"Transforming XML With SAX Filters"[1] is outdated, it suggests using  
using XML::Handler::YAWriter and XML::Parser::PerlSAX in the parser  
when XML::SAX and XML::SAX::Writer are better, newer choices. Idem  
for XML::Filter::Base in the module, now XML::SAX::Base.

[1] http://www.xml.com/pub/a/2001/10/10/sax-filters.html
-- 
olivier

Received on Friday, 2 September 2005 04:33:42 UTC