XML::Parser::LiteCopy(3pm) - phpMan

Command: man perldoc info search(apropos)  


XML::Parser::LiteCopy(3pm)     User Contributed Perl Documentation     XML::Parser::LiteCopy(3pm)

NAME
       XML::Parser::LiteCopy - Lightweight regexp-based XML parser

SYNOPSIS
         use XML::Parser::LiteCopy;

         $p1 = new XML::Parser::LiteCopy;
         $p1->setHandlers(
           Start => sub { shift; print "start: @_\n" },
           Char => sub { shift; print "char: @_\n" },
           End => sub { shift; print "end: @_\n" },
         );
         $p1->parse('<foo id="me">Hello World!</foo>');

         $p2 = new XML::Parser::LiteCopy
           Handlers => {
             Start => sub { shift; print "start: @_\n" },
             Char => sub { shift; print "char: @_\n" },
             End => sub { shift; print "end: @_\n" },
           }
         ;
         $p2->parse('<foo id="me">Hello <bar>cruel</bar> World!</foo>');

DESCRIPTION
       This Perl implements an XML parser with a interface similar to XML::Parser. Though not all
       callbacks are supported, you should be able to use it in the same way you use XML::Parser.
       Due to using experimantal regexp features it'll work only on Perl 5.6 and above and may
       behave differently on different platforms.

       Note that you cannot use regular expressions or split in callbacks. This is due to a
       limitation of perl's regular expression implementation (which is not re-entrant).

SUBROUTINES/METHODS
   new
       Constructor.

       As (almost) all SOAP::Lite constructors, new() returns the object called on when called as
       object method. This means that the following effectifely is a no-op if $obj is a object:

        $obj = $obj->new();

       New accepts a single named parameter, "Handlers" with a hash ref as value:

        my $parser = XML::Parser::Lite->new(
           Handlers => {
               Start => sub { shift; print "start: @_\n" },
               Char => sub { shift; print "char: @_\n" },
               End => sub { shift; print "end: @_\n" },
           }
        );

       The handlers given will be passed to setHandlers.

   setHandlers
       Sets (or resets) the parsing handlers. Accepts a hash with the handler names and handler
       code references as parameters. Passing "undef" instead of a code reference replaces the
       handler by a no-op.

       The following handlers can be set:

        Init
        Start
        Char
        End
        Final
        CData
        Doctype
        Comment
        PI

       All other handlers are ignored.

       Calling setHandlers without parameters resets all handlers to no-ops.

   parse
       Parses the XML given. In contrast to XML::Parser's parse method, parse() only parses
       strings.

Handler methods
   Init
       Called before parsing starts. You should perform any necessary initializations in Init.

   Start
       Called at the start of each XML node. See XML::Parser for details.

   Char
       Called for each character sequence. May be called multiple times for the characters
       contained in an XML node (even for every single character).  Your implementation has to
       make sure that it captures all characters.

   End
       Called at the end of each XML node. See XML::Parser for details

   Comment
       See XML::Parser for details

   PI
       See XMLDecl in XML::Parser for details, but also includes other processing instructions

   Doctype
       See XML::Parser for details

   Final
       Called at the end of the parsing process. You should perform any necessary cleanup here.

SEE ALSO
        XML::Parser

COPYRIGHT
       Copyright (C) 2000-2007 Paul Kulchenko. All rights reserved.

       Copyright (C) 2008 Martin Kutter. All rights reserved.

       Copyright (C) 2009 Cal Henderson. All rights reserved.

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

       This parser is based on "shallow parser" http://www.cs.sfu.ca/~cameron/REX.html Copyright
       (c) 1998, Robert D. Cameron.

AUTHOR
       Paul Kulchenko (paulclinger AT yahoo.com)

       Martin Kutter (martin.kutter AT fen-net.de)

       Additional handlers supplied by Adam Leggett.

       Further modifications by Cal Henderson.

perl v5.32.0                                2021-01-05                 XML::Parser::LiteCopy(3pm)

Generated by $Id: phpMan.php,v 4.55 2007/09/05 04:42:51 chedong Exp $ Author: Che Dong
On Apache
Under GNU General Public License
2024-12-12 16:57 @18.226.87.143 CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0!Valid CSS!