{
    "content": [
        {
            "type": "text",
            "text": "# Data::Grove::Visitor (perldoc)\n\n## NAME\n\nData::Grove::Visitor - add visitor/callback methods to Data::Grove objects\n\n## SYNOPSIS\n\nuse Data::Grove::Visitor;\n@results = $object->accept ($visitor, ...);\n@results = $object->acceptname ($visitor, ...);\n@results = $object->childrenaccept ($visitor, ...);\n@results = $object->childrenacceptname ($visitor, ...);\n\n## DESCRIPTION\n\nData::Grove::Visitor adds visitor methods (callbacks) to Data::Grove objects. A ``visitor'' is a\nclass (a package) you write that has methods (subs) corresponding to the objects in the classes\nbeing visited. You use the visitor methods by creating an instance of your visitor class, and\nthen calling `\"accept($myvisitor)\"' on the top-most object you want to visit, that object will\nin turn call your visitor back with `\"visit*OBJECT*\"', where *OBJECT* is the type of object.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **RESERVED NAMES**\n- **NOTES**\n- **AUTHOR**\n- **SEE ALSO** (1 subsections)\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Data::Grove::Visitor",
        "section": "",
        "mode": "perldoc",
        "summary": "Data::Grove::Visitor - add visitor/callback methods to Data::Grove objects",
        "synopsis": "use Data::Grove::Visitor;\n@results = $object->accept ($visitor, ...);\n@results = $object->acceptname ($visitor, ...);\n@results = $object->childrenaccept ($visitor, ...);\n@results = $object->childrenacceptname ($visitor, ...);",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 23,
                "subsections": []
            },
            {
                "name": "RESERVED NAMES",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "NOTES",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 1,
                "subsections": [
                    {
                        "name": "perl",
                        "lines": 2
                    }
                ]
            }
        ],
        "sections": {
            "NAME": {
                "content": "Data::Grove::Visitor - add visitor/callback methods to Data::Grove objects\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use Data::Grove::Visitor;\n\n@results = $object->accept ($visitor, ...);\n@results = $object->acceptname ($visitor, ...);\n@results = $object->childrenaccept ($visitor, ...);\n@results = $object->childrenacceptname ($visitor, ...);\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Data::Grove::Visitor adds visitor methods (callbacks) to Data::Grove objects. A ``visitor'' is a\nclass (a package) you write that has methods (subs) corresponding to the objects in the classes\nbeing visited. You use the visitor methods by creating an instance of your visitor class, and\nthen calling `\"accept($myvisitor)\"' on the top-most object you want to visit, that object will\nin turn call your visitor back with `\"visit*OBJECT*\"', where *OBJECT* is the type of object.\n\nThere are several forms of `\"accept\"'. Simply calling `\"accept\"' calls your package back using\nthe object type of the object you are visiting. Calling `\"acceptname\"' on an element object\ncalls you back with `\"visitname*NAME*\"' where *NAME* is the tag name of the element, on all\nother objects it's as if you called `\"accept\"'.\n\nAll of the forms of `\"accept\"' return a concatenated list of the result of all `\"visit\"'\nmethods.\n\n`\"childrenaccept\"' calls `\"accept\"' on each of the children of the element. This is generally\nused in element callbacks to recurse down into the element's children, you don't need to get the\nelement's contents and call `\"accept\"' on each item. `\"childrenacceptname\"' does the same but\ncalling `\"acceptname\"' on each of the children. `\"attraccept\"' calls `\"accept\"' on each of the\nobjects in the named attribute.\n\nRefer to the documentation of the classes you are visiting (XML::Grove, etc.) for the type names\n(`\"element\"', `\"document\"', etc.) of the objects it implements.\n",
                "subsections": []
            },
            "RESERVED NAMES": {
                "content": "The hash keys `\"Contents\"' and `\"Name\"' are used to indicate objects with children (for\n`\"childrenaccept\"') and named objects (for `\"acceptname\"').\n",
                "subsections": []
            },
            "NOTES": {
                "content": "These are random ideas that haven't been implemented yet:\n\n*   Several objects fall into subclasses, or you may want to be able to subclass a visited\nobject and still be able to tell the difference. In SGML::Grove I had used the package name\nin the callback (`\"visitSGMLElement\"') instead of a generic name (`\"visitelement\"'). The\nidea here would be to try calling `\"visit*PACKAGE*\"' with the most specific class first,\nthen try superclasses, and lastly to try the generic.\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Ken MacLeod, ken@bitsko.slc.ut.us\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "",
                "subsections": [
                    {
                        "name": "perl",
                        "content": "Extensible Markup Language (XML) <http://www.w3c.org/XML>\n"
                    }
                ]
            }
        }
    }
}