W3C home > Mailing lists > Public > www-archive@w3.org > September 2005

(rough) perl sax outline filter

From: olivier Thereaux <ot@w3.org>
Date: Fri, 2 Sep 2005 13:33:35 +0900
To: www-archive@w3.org
Message-Id: <12E03E07-9633-4473-BE34-5A495775B53D@w3.org>
[ 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

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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:32:45 UTC