# Copyright (c) 2002-2003 the World Wide Web Consortium :
#       Keio University,
#       European Research Consortium for Informatics and Mathematics
#       Massachusetts Institute of Technology.
# written by Olivier Thereaux <ot@w3.org> for W3C
#
# $Id: HTMLValidator.pm,v 1.21 2005/08/01 05:04:10 ot Exp $

package Outline;
use strict;
use base qw(XML::SAX::Base);
@Outline::ISA = qw(XML::SAX::Base);

sub new
{
  my $proto = shift;
  my $class = ref($proto) || $proto;
  my %options = @_;
  return bless \%options, $class;
}


our $keep_element = 0;
our $current_level = 0;
sub start_element {
  my ($self, $element) = @_;
  if ($element->{Name} =~ /^h[1-6]$/) {
    $self->SUPER::start_element($element);
    $keep_element = 1;
  }
  else {
    $keep_element = 0;
  }
}

sub characters {
  my ($self, $chars) = @_;
  if ($keep_element == 1) {
    $self->SUPER::characters($chars);
  }
  else {
    # nothing
  }
}

sub end_element {
  my ($self, $element) = @_;
  if ($keep_element == 1) {
    $self->SUPER::end_element($element);
  }
  $keep_element = 0;
}

1; # return true



