Stevan Little

NAME

Tree::Simple::SAX::Handler - An XML::SAX Handler to create Tree::Simple objects from XML

SYNOPSIS

  use Tree::Simple::SAX;
  use XML::SAX::ParserFactory;
  
  my $handler = Tree::Simple::SAX::Handler->new(Tree::Simple->new());
  
  my $p = XML::SAX::ParserFactory->parser(Handler => $handler);
  $p->parse_string('<xml><string>Hello <world/>!</string></xml>');    
  
  # this will create a tree like this:
  # { tag_type => 'xml' }
  #         { tag_type => 'string' }
  #                 { content => 'Hello ', tag_type => 'CDATA' }
  #                 { tag_type => 'world' }
  #                 { content => '!', tag_type => 'CDATA' }

DESCRIPTION

This is a proof-of-concept XML::SAX handler which can build Tree::Simple hierarchies. See the Tree::Simple::SAX for more information.

METHODS

new ($root_tree)
getRootTree

SAX Handler Methods

start_element
end_element
characters

TO DO

Support more SAX handler hooks

I only support the basic start_element, end_element and character. I need to add more hooks to handle more sophisticated XML documents.

BUGS

None that I am aware of. Of course, if you find a bug, let me know, and I will be sure to fix it.

CODE COVERAGE

I use Devel::Cover to test the code coverage of my tests, see the CODE COVERAGE section of Tree::Simple::SAX for more details.

AUTHOR

stevan little, <stevan@iinteractive.com>

COPYRIGHT AND LICENSE

Copyright 2005 by Infinity Interactive, Inc.

http://www.iinteractive.com

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.