{
    "content": [
        {
            "type": "text",
            "text": "# XML::Grove::Factory (perldoc)\n\n## NAME\n\nXML::Grove::Factory - simplify creation of XML::Grove objects\n\n## SYNOPSIS\n\nuse XML::Grove::Factory;\n### An object that creates Grove objects directly\nmy $gf = XML::Grove::Factory->grovefactory;\n$grove = $gf->document( CONTENTS );\n$element = $gf->element( $name, { ATTRIBUTES }, CONTENTS );\n$pi = $gf->pi( $target, $data );\n$comment = $gf->comment( $data );\n### An object that creates elements by method name\nmy $ef = XML::Grove::Factory->elementfactory();\n$element = $ef->NAME( { ATTRIBUTES }, CONTENTS);\n### Similar to `elementfactory', but creates functions in the\n### current package\nXML::Grove::Factory->elementfunctions( PREFIX, ELEMENTS );\n$element = NAME( { ATTRIBUTES }, CONTENTS );\n\n## DESCRIPTION\n\n\"XML::Grove::Factory\" provides objects or defines functions that let you simply and quickly\ncreate the most commonly used XML::Grove objects. \"XML::Grove::Factory\" supports three types of\nobject creation. The first type is to create raw XML::Grove objects. The second type creates XML\nelements by element name. The third type is like the second, but defines local functions for you\nto call instead of using an object, which might save typing in some cases.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **GROVE FACTORY**\n- **ELEMENT FACTORY**\n- **ELEMENT FUNCTIONS**\n- **AUTHOR**\n- **SEE ALSO** (1 subsections)\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "XML::Grove::Factory",
        "section": "",
        "mode": "perldoc",
        "summary": "XML::Grove::Factory - simplify creation of XML::Grove objects",
        "synopsis": "use XML::Grove::Factory;\n### An object that creates Grove objects directly\nmy $gf = XML::Grove::Factory->grovefactory;\n$grove = $gf->document( CONTENTS );\n$element = $gf->element( $name, { ATTRIBUTES }, CONTENTS );\n$pi = $gf->pi( $target, $data );\n$comment = $gf->comment( $data );\n### An object that creates elements by method name\nmy $ef = XML::Grove::Factory->elementfactory();\n$element = $ef->NAME( { ATTRIBUTES }, CONTENTS);\n### Similar to `elementfactory', but creates functions in the\n### current package\nXML::Grove::Factory->elementfunctions( PREFIX, ELEMENTS );\n$element = NAME( { ATTRIBUTES }, CONTENTS );",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 21,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 23,
                "subsections": []
            },
            {
                "name": "GROVE FACTORY",
                "lines": 34,
                "subsections": []
            },
            {
                "name": "ELEMENT FACTORY",
                "lines": 22,
                "subsections": []
            },
            {
                "name": "ELEMENT FUNCTIONS",
                "lines": 27,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 1,
                "subsections": [
                    {
                        "name": "perl",
                        "lines": 2
                    }
                ]
            }
        ],
        "sections": {
            "NAME": {
                "content": "XML::Grove::Factory - simplify creation of XML::Grove objects\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use XML::Grove::Factory;\n\n### An object that creates Grove objects directly\nmy $gf = XML::Grove::Factory->grovefactory;\n\n$grove = $gf->document( CONTENTS );\n$element = $gf->element( $name, { ATTRIBUTES }, CONTENTS );\n$pi = $gf->pi( $target, $data );\n$comment = $gf->comment( $data );\n\n### An object that creates elements by method name\nmy $ef = XML::Grove::Factory->elementfactory();\n\n$element = $ef->NAME( { ATTRIBUTES }, CONTENTS);\n\n### Similar to `elementfactory', but creates functions in the\n### current package\nXML::Grove::Factory->elementfunctions( PREFIX, ELEMENTS );\n\n$element = NAME( { ATTRIBUTES }, CONTENTS );\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "\"XML::Grove::Factory\" provides objects or defines functions that let you simply and quickly\ncreate the most commonly used XML::Grove objects. \"XML::Grove::Factory\" supports three types of\nobject creation. The first type is to create raw XML::Grove objects. The second type creates XML\nelements by element name. The third type is like the second, but defines local functions for you\nto call instead of using an object, which might save typing in some cases.\n\nThe three types of factories can be mixed. For example, you can use local functions for all\nelement names that don't conflict with your own sub names or contain special characters, and\nthen use a `\"grovefactory()\"' object for those elements that do conflict.\n\nIn the examples that follow, each example is creating an XML instance similar to the following,\nassuming it's pretty printed:\n\n<?xml version=\"1.0\"?>\n<HTML>\n<HEAD>\n<TITLE>Some Title</TITLE>\n</HEAD>\n<BODY bgcolor=\"#FFFFFF\">\n<P>A paragraph.</P>\n</BODY>\n</HTML>\n",
                "subsections": []
            },
            "GROVE FACTORY": {
                "content": "$gf = XML::Grove::Factory->grovefactory()\nCreates a new grove factory object that creates raw XML::Grove objects.\n\n$gf->document( *CONTENTS* );\nCreates an XML::Grove::Document object. *CONTENTS* may contain processing instructions,\nstrings containing only whitespace characters, and a single element object (but note that\nthere is no checking). Strings are converted to XML::Grove::Characters objects.\n\n$gf->element($name, *CONTENTS*);\n$gf->element($name, { *ATTRIBUTES* }, *CONTENTS*);\nCreates an XML::Grove::Element object with the name `$name'. If the argument following\n`$name' is an anonymous hash, *ATTRIBUTES*, then they will be copied to the elements\nattributes. *CONTENTS* will be stored in the element's content (note that there is no\nvalidity checking). Strings in *CONTENTS* are converted to XML::Grove::Characters objects.\n\n$gf->pi( *TARGET*, *DATA*)\n$gf->pi( *DATA* )\nCreate an XML::Grove::PI object with *TARGET* and *DATA*.\n\n$gf->comment( *DATA* )\nCreate an XML::Grove::Comment object with *DATA*.\n\nGROVE FACTORY EXAMPLE\nuse XML::Grove::Factory;\n\n$gf = XML::Grove::Factory->grovefactory;\n\n$element =\n$gf->element('HTML',\n$gf->element('HEAD',\n$gf->element('TITLE', 'Some Title')),\n$gf->element('BODY', { bgcolor => '#FFFFFF' },\n$gf->element('P', 'A paragraph.')));\n",
                "subsections": []
            },
            "ELEMENT FACTORY": {
                "content": "$ef = XML::Grove::Factory->elementfactory()\nCreates a new element factory object for creating elements. `\"elementfactory()\"' objects\nwork by creating an element for any name used to call the object.\n\n$ef->*NAME*( *CONTENTS* )\n$ef->*NAME*( { *ATTRIBUTES* }, *CONTENTS*)\nCreates an XML::Grove::Element object with the given *NAME*, *ATTRIBUTES*, and *CONTENTS*.\nThe hash containing *ATTRIBUTES* is optional if this element doesn't need attributes.\nStrings in *CONTENTS* are converted to XML::Grove::Characters objects.\n\nELEMENT FACTORY EXAMPLE\nuse XML::Grove::Factory;\n\n$ef = XML::Grove::Factory->elementfactory();\n\n$element =\n$ef->HTML(\n$ef->HEAD(\n$ef->TITLE('Some Title')),\n$ef->BODY({ bgcolor => '#FFFFFF' },\n$ef->P('A paragraph.')));\n",
                "subsections": []
            },
            "ELEMENT FUNCTIONS": {
                "content": "XML::Grove::Factory->elementfunctions (PREFIX, ELEMENTS)\nCreates functions in the current package for creating elements with the names provided in\nthe list *ELEMENTS*. *PREFIX* will be prepended to every function name, or *PREFIX* can be\nan empty string ('') if you're confident that there won't be any conflicts with functions in\nyour package.\n\n*NAME*( *CONTENTS* )\n*NAME*( { *ATTRIBUTES* }, *CONTENTS* )\n*PREFIXNAME*( *CONTENTS* )\n*PREFIXNAME*( { *ATTRIBUTES* }, *CONTENTS* )\nFunctions created for `\"*NAME*\"' or `\"*PREFIXNAME*\"' can be called to create\nXML::Grove::Element objects with the given *NAME*, *ATTRIBUTES*, and *CONTENT*. The hash\ncontaining *ATTRIBUTES* is optional if this element doesn't need attributes. Strings in\n*CONTENT* are converted to XML::Grove::Characters objects.\n\nELEMENT FACTORY EXAMPLE\nuse XML::Grove::Factory;\n\nXML::Grove::Factory->elementfunctions('', qw{ HTML HEAD TITLE BODY P });\n\n$element =\nHTML(\nHEAD(\nTITLE('Some Title')),\nBODY({ bgcolor => '#FFFFFF' },\nP('A paragraph.')));\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Ken MacLeod, ken@bitsko.slc.ut.us\n\nInspired by the HTML::AsSubs module by Gisle Aas.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "",
                "subsections": [
                    {
                        "name": "perl",
                        "content": "Extensible Markup Language (XML) <http://www.w3c.org/XML>\n"
                    }
                ]
            }
        }
    }
}