{
    "mode": "perldoc",
    "parameter": "XML::Handler::Subs",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/XML%3A%3AHandler%3A%3ASubs/json",
    "generated": "2026-06-10T16:27:55Z",
    "synopsis": "use XML::Handler::Subs;\npackage MyHandlers;\nuse vars qw{ @ISA };\nsub sNAME { my ($self, $element) = @ };\nsub eNAME { my ($self, $element) = @ };\n$self->{Names};    # an array of names\n$self->{Nodes};    # an array of $element nodes\n$handler = MyHandlers->new();\n$self->inelement($name);\n$self->withinelement($name);",
    "sections": {
        "NAME": {
            "content": "XML::Handler::Subs - a PerlSAX handler base class for calling user-defined subs\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use XML::Handler::Subs;\n\npackage MyHandlers;\nuse vars qw{ @ISA };\n\nsub sNAME { my ($self, $element) = @ };\nsub eNAME { my ($self, $element) = @ };\n\n$self->{Names};    # an array of names\n$self->{Nodes};    # an array of $element nodes\n\n$handler = MyHandlers->new();\n$self->inelement($name);\n$self->withinelement($name);\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "\"XML::Handler::Subs\" is a base class for PerlSAX handlers. \"XML::Handler::Subs\" is subclassed to\nimplement complete behavior and to add element-specific handling.\n\nEach time an element starts, a method by that name prefixed with `s' is called with the element\nto be processed. Each time an element ends, a method with that name prefixed with `e' is\ncalled. Any special characters in the element name are replaced by underscores.\n\nSubclassing XML::Handler::Subs in this way is similar to XML::Parser's Subs style.\n\nXML::Handler::Subs maintains a stack of element names, `\"$self-\"{Names}', and a stack of element\nnodes, `\"$self-\"{Nodes}>' that can be used by subclasses. The current element is pushed on the\nstacks before calling an element-name start method and popped off the stacks after calling the\nelement-name end method. The `\"inelement()\"' and `\"withinelement()\"' calls use these stacks.\n\nIf the subclass implements `\"startdocument()\"', `\"enddocument()\"', `\"startelement()\"', and\n`\"endelement()\"', be sure to use `\"SUPER::\"' to call the the superclass methods also. See",
            "subsections": [
                {
                    "name": "perlobj",
                    "content": "return 1 if an element-name method is called, they return 0 if no method was called.\n\nXML::Handler::Subs does not implement any other PerlSAX handlers.\n\nXML::Handler::Subs supports the following methods:\n"
                },
                {
                    "name": "new",
                    "content": "A basic `\"new()\"' method. `\"new()\"' takes a list of key, value pairs or a hash and creates\nand returns a hash with those options; the hash is blessed into the subclass.\n"
                },
                {
                    "name": "in_element",
                    "content": "Returns true if `$name' is equal to the name of the innermost currently opened element.\n"
                },
                {
                    "name": "within_element",
                    "content": "Returns the number of times the `$name' appears in Names.\n"
                }
            ]
        },
        "AUTHOR": {
            "content": "Ken MacLeod, ken@bitsko.slc.ut.us\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "",
            "subsections": [
                {
                    "name": "perl",
                    "content": ""
                }
            ]
        }
    },
    "summary": "XML::Handler::Subs - a PerlSAX handler base class for calling user-defined subs",
    "flags": [],
    "examples": [],
    "see_also": []
}