{
    "content": [
        {
            "type": "text",
            "text": "# XML::LibXML::Simple (perldoc)\n\n## NAME\n\nXML::LibXML::Simple - XML::LibXML clone of XML::Simple::XMLin()\n\n## SYNOPSIS\n\nmy $xml  = ...;  # filename, fh, string, or XML::LibXML-node\nImperative:\nuse XML::LibXML::Simple   qw(XMLin);\nmy $data = XMLin $xml, %options;\nOr the Object Oriented way:\nuse XML::LibXML::Simple   ();\nmy $xs   = XML::LibXML::Simple->new(%options);\nmy $data = $xs->XMLin($xml, %options);\n\n## DESCRIPTION\n\nThis module is a blunt rewrite of XML::Simple (by Grant McLean) to use the XML::LibXML parser\nfor XML structures, where the original uses plain Perl or SAX parsers.\n\n## Sections\n\n- **NAME**\n- **INHERITANCE**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **METHODS** (2 subsections)\n- **FUNCTIONS**\n- **DETAILS**\n- **EXAMPLES** (1 subsections)\n- **SEE ALSO**\n- **COPYRIGHTS**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "XML::LibXML::Simple",
        "section": "",
        "mode": "perldoc",
        "summary": "XML::LibXML::Simple - XML::LibXML clone of XML::Simple::XMLin()",
        "synopsis": "my $xml  = ...;  # filename, fh, string, or XML::LibXML-node\nImperative:\nuse XML::LibXML::Simple   qw(XMLin);\nmy $data = XMLin $xml, %options;\nOr the Object Oriented way:\nuse XML::LibXML::Simple   ();\nmy $xs   = XML::LibXML::Simple->new(%options);\nmy $data = $xs->XMLin($xml, %options);",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [
            "When \"XMLin()\" reads the following very simple piece of XML:",
            "<opt username=\"testuser\" password=\"frodo\"></opt>",
            "it returns the following data structure:",
            "username => 'testuser',",
            "password => 'frodo'",
            "The identical result could have been produced with this alternative XML:",
            "<opt username=\"testuser\" password=\"frodo\" />",
            "Or this (although see 'ForceArray' option for variations):",
            "<opt>",
            "<username>testuser</username>",
            "<password>frodo</password>",
            "</opt>",
            "Repeated nested elements are represented as anonymous arrays:",
            "<opt>",
            "<person firstname=\"Joe\" lastname=\"Smith\">",
            "<email>joe@smith.com</email>",
            "<email>jsmith@yahoo.com</email>",
            "</person>",
            "<person firstname=\"Bob\" lastname=\"Smith\">",
            "<email>bob@smith.com</email>",
            "</person>",
            "</opt>",
            "person => [",
            "{ email     => [ 'joe@smith.com', 'jsmith@yahoo.com' ],",
            "firstname => 'Joe',",
            "lastname  => 'Smith'",
            "},",
            "{ email     => 'bob@smith.com',",
            "firstname => 'Bob',",
            "lastname  => 'Smith'",
            "Nested elements with a recognised key attribute are transformed (folded) from an array into a",
            "hash keyed on the value of that attribute (see the \"KeyAttr\" option):",
            "<opt>",
            "<person key=\"jsmith\" firstname=\"Joe\" lastname=\"Smith\" />",
            "<person key=\"tsmith\" firstname=\"Tom\" lastname=\"Smith\" />",
            "<person key=\"jbloggs\" firstname=\"Joe\" lastname=\"Bloggs\" />",
            "</opt>",
            "person => {",
            "jbloggs => {",
            "firstname => 'Joe',",
            "lastname  => 'Bloggs'",
            "},",
            "tsmith  => {",
            "firstname => 'Tom',",
            "lastname  => 'Smith'",
            "},",
            "jsmith => {",
            "firstname => 'Joe',",
            "lastname => 'Smith'",
            "The <anon> tag can be used to form anonymous arrays:",
            "<opt>",
            "<head><anon>Col 1</anon><anon>Col 2</anon><anon>Col 3</anon></head>",
            "<data><anon>R1C1</anon><anon>R1C2</anon><anon>R1C3</anon></data>",
            "<data><anon>R2C1</anon><anon>R2C2</anon><anon>R2C3</anon></data>",
            "<data><anon>R3C1</anon><anon>R3C2</anon><anon>R3C3</anon></data>",
            "</opt>",
            "head => [ [ 'Col 1', 'Col 2', 'Col 3' ] ],",
            "data => [ [ 'R1C1', 'R1C2', 'R1C3' ],",
            "[ 'R2C1', 'R2C2', 'R2C3' ],",
            "[ 'R3C1', 'R3C2', 'R3C3' ]",
            "Anonymous arrays can be nested to arbirtrary levels and as a special case, if the surrounding",
            "tags for an XML document contain only an anonymous array the arrayref will be returned directly",
            "rather than the usual hashref:",
            "<opt>",
            "<anon><anon>Col 1</anon><anon>Col 2</anon></anon>",
            "<anon><anon>R1C1</anon><anon>R1C2</anon></anon>",
            "<anon><anon>R2C1</anon><anon>R2C2</anon></anon>",
            "</opt>",
            "[ 'Col 1', 'Col 2' ],",
            "[ 'R1C1', 'R1C2' ],",
            "[ 'R2C1', 'R2C2' ]",
            "Elements which only contain text content will simply be represented as a scalar. Where an",
            "element has both attributes and text content, the element will be represented as a hashref with",
            "the text content in the 'content' key (see the \"ContentKey\" option):",
            "<opt>",
            "<one>first</one>",
            "<two attr=\"value\">second</two>",
            "</opt>",
            "one => 'first',",
            "two => { attr => 'value', content => 'second' }",
            "Mixed content (elements which contain both text content and nested elements) will be not be",
            "represented in a useful way - element order and significant whitespace will be lost. If you need",
            "to work with mixed content, then XML::Simple is not the right tool for your job - check out the",
            "next section.",
            "In general, the output and the options are equivalent, although this module has some differences",
            "with XML::Simple to be aware of.",
            "only XMLin() is supported",
            "If you want to write XML then use a schema (for instance with XML::Compile). Do not attempt",
            "to create XML by hand! If you still think you need it, then have a look at XMLout() as",
            "implemented by XML::Simple or any of a zillion template systems.",
            "no \"variables\" option",
            "IMO, you should use a templating system if you want variables filled-in in the input: it is",
            "not a task for this module.",
            "ForceArray options",
            "There are a few small differences in the result of the \"forcearray\" option, because",
            "XML::Simple seems to behave inconsequently.",
            "hooks",
            "XML::Simple does not support hooks."
        ],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "INHERITANCE",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 13,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Constructors",
                        "lines": 7
                    },
                    {
                        "name": "Translators",
                        "lines": 3
                    }
                ]
            },
            {
                "name": "FUNCTIONS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "DETAILS",
                "lines": 455,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 125,
                "subsections": [
                    {
                        "name": "Differences to XML::Simple",
                        "lines": 19
                    }
                ]
            },
            {
                "name": "SEE ALSO",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "COPYRIGHTS",
                "lines": 9,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "XML::LibXML::Simple - XML::LibXML clone of XML::Simple::XMLin()\n",
                "subsections": []
            },
            "INHERITANCE": {
                "content": "XML::LibXML::Simple\nis a Exporter\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "my $xml  = ...;  # filename, fh, string, or XML::LibXML-node\n\nImperative:\n\nuse XML::LibXML::Simple   qw(XMLin);\nmy $data = XMLin $xml, %options;\n\nOr the Object Oriented way:\n\nuse XML::LibXML::Simple   ();\nmy $xs   = XML::LibXML::Simple->new(%options);\nmy $data = $xs->XMLin($xml, %options);\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This module is a blunt rewrite of XML::Simple (by Grant McLean) to use the XML::LibXML parser\nfor XML structures, where the original uses plain Perl or SAX parsers.\n\nBe warned: this module thinks to be smart. You may very well shoot yourself in the foot with\nthis DWIMmery. Read the whole manual page at least once before you start using it. If your XML\nis described in a schema or WSDL, then use XML::Compile for maintainable code.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "",
                "subsections": [
                    {
                        "name": "Constructors",
                        "content": "XML::LibXML::Simple->new(%options)\nInstantiate an object, which can be used to call XMLin() on. You can provide %options to\nthis constructor (to be reused for each call to XMLin) and with each call of XMLin (to be\nused once)\n\nFor descriptions of the %options see the \"DETAILS\" section of this manual page.\n"
                    },
                    {
                        "name": "Translators",
                        "content": "$obj->XMLin($xmldata, %options)\nFor $xmldata and descriptions of the %options see the \"DETAILS\" section of this manual page.\n"
                    }
                ]
            },
            "FUNCTIONS": {
                "content": "The functions \"XMLin\" (exported implictly) and \"xmlin\" (exported on request) simply call\n\"<XML::LibXML::Simple-\"new->XMLin() >> with the provided parameters.\n",
                "subsections": []
            },
            "DETAILS": {
                "content": "Parameter $xmldata\nAs first parameter to XMLin() must provide the XML message to be translated into a Perl\nstructure. Choose one of the following:\n\nA filename\nIf the filename contains no directory components, \"XMLin()\" will look for the file in each\ndirectory in the SearchPath (see OPTIONS below) and in the current directory. eg:\n\n$data = XMLin('/etc/params.xml', %options);\n\nA dash (-)\nParse from STDIN.\n\n$data = XMLin('-', %options);\n\nundef\n[deprecated] If there is no XML specifier, \"XMLin()\" will check the script directory and\neach of the SearchPath directories for a file with the same name as the script but with the\nextension '.xml'. Note: if you wish to specify options, you must specify the value 'undef'.\neg:\n\n$data = XMLin(undef, ForceArray => 1);\n\nThis feature is available for backwards compatibility with XML::Simple, but quite sensitive.\nYou can easily hit the wrong xml file as input. Please do not use it: always use an explicit\nfilename.\n\nA string of XML\nA string containing XML (recognised by the presence of '<' and '>' characters) will be\nparsed directly. eg:\n\n$data = XMLin('<opt username=\"bob\" password=\"flurp\" />', %options);\n\nAn IO::Handle object\nIn this case, XML::LibXML::Parser will read the XML data directly from the provided file.\n\n# $fh = IO::File->new('/etc/params.xml') or die;\nopen my $fh, '<:encoding(utf8)', '/etc/params.xml' or die;\n\n$data = XMLin($fh, %options);\n\nAn XML::LibXML::Document or ::Element\n[Not available in XML::Simple] When you have a pre-parsed XML::LibXML node, you can pass\nthat.\n\nParameter %options\nXML::LibXML::Simple supports most options defined by XML::Simple, so the interface is quite\ncompatible. Minor changes apply. This explanation is extracted from the XML::Simple manual-page.\n\n*   check out \"ForceArray\" because you'll almost certainly want to turn it on\n\n*   make sure you know what the \"KeyAttr\" option does and what its default value is because it\nmay surprise you otherwise.\n\n*   Option names are case in-sensitive so you can use the mixed case versions shown here; you\ncan add underscores between the words (eg: keyattr) if you like.\n\nIn alphabetic order:\n\nContentKey => 'keyname' *# seldom used*\nWhen text content is parsed to a hash value, this option lets you specify a name for the\nhash key to override the default 'content'. So for example:\n\nXMLin('<opt one=\"1\">Two</opt>', ContentKey => 'text')\n\nwill parse to:\n\n{ one => 1, text => 'Two' }\n\ninstead of:\n\n{ one => 1, content => 'Two' }\n\nYou can also prefix your selected key name with a '-' character to have \"XMLin()\" try a\nlittle harder to eliminate unnecessary 'content' keys after array folding. For example:\n\nXMLin(\n'<opt><item name=\"one\">First</item><item name=\"two\">Second</item></opt>',\nKeyAttr => {item => 'name'},\nForceArray => [ 'item' ],\nContentKey => '-content'\n)\n\nwill parse to:\n\n{\nitem => {\none =>  'First'\ntwo =>  'Second'\n}\n}\n\nrather than this (without the '-'):\n\n{\nitem => {\none => { content => 'First' }\ntwo => { content => 'Second' }\n}\n}\n\nForceArray => 1 *# important*\nThis option should be set to '1' to force nested elements to be represented as arrays even\nwhen there is only one. Eg, with ForceArray enabled, this XML:\n\n<opt>\n<name>value</name>\n</opt>\n\nwould parse to this:\n\n{ name => [ 'value' ] }\n\ninstead of this (the default):\n\n{ name => 'value' }\n\nThis option is especially useful if the data structure is likely to be written back out as\nXML and the default behaviour of rolling single nested elements up into attributes is not\ndesirable.\n\nIf you are using the array folding feature, you should almost certainly enable this option.\nIf you do not, single nested elements will not be parsed to arrays and therefore will not be\ncandidates for folding to a hash. (Given that the default value of 'KeyAttr' enables array\nfolding, the default value of this option should probably also have been enabled as well).\n\nForceArray => [ names ] *# important*\nThis alternative (and preferred) form of the 'ForceArray' option allows you to specify a\nlist of element names which should always be forced into an array representation, rather\nthan the 'all or nothing' approach above.\n\nIt is also possible to include compiled regular expressions in the list --any element names\nwhich match the pattern will be forced to arrays. If the list contains only a single regex,\nthen it is not necessary to enclose it in an arrayref. Eg:\n\nForceArray => qr/list$/\n\nForceContent => 1 *# seldom used*\nWhen \"XMLin()\" parses elements which have text content as well as attributes, the text\ncontent must be represented as a hash value rather than a simple scalar. This option allows\nyou to force text content to always parse to a hash value even when there are no attributes.\nSo for example:\n\nXMLin('<opt><x>text1</x><y a=\"2\">text2</y></opt>', ForceContent => 1)\n\nwill parse to:\n\n{\nx => {         content => 'text1' },\ny => { a => 2, content => 'text2' }\n}\n\ninstead of:\n\n{\nx => 'text1',\ny => { 'a' => 2, 'content' => 'text2' }\n}\n\nGroupTags => { grouping tag => grouped tag } *# handy*\nYou can use this option to eliminate extra levels of indirection in your Perl data\nstructure. For example this XML:\n\n<opt>\n<searchpath>\n<dir>/usr/bin</dir>\n<dir>/usr/local/bin</dir>\n<dir>/usr/X11/bin</dir>\n</searchpath>\n</opt>\n\nWould normally be read into a structure like this:\n\n{\nsearchpath => {\ndir => [ '/usr/bin', '/usr/local/bin', '/usr/X11/bin' ]\n}\n}\n\nBut when read in with the appropriate value for 'GroupTags':\n\nmy $opt = XMLin($xml, GroupTags => { searchpath => 'dir' });\n\nIt will return this simpler structure:\n\n{\nsearchpath => [ '/usr/bin', '/usr/local/bin', '/usr/X11/bin' ]\n}\n\nThe grouping element (\"<searchpath>\" in the example) must not contain any attributes or\nelements other than the grouped element.\n\nYou can specify multiple 'grouping element' to 'grouped element' mappings in the same\nhashref. If this option is combined with \"KeyAttr\", the array folding will occur first and\nthen the grouped element names will be eliminated.\n\nHookNodes => CODE\nSelect document nodes to apply special tricks. Introduced in [0.96], not available in\nXML::Simple.\n\nWhen this option is provided, the CODE will be called once the XML DOM tree is ready to get\ntransformed into Perl. Your CODE should return either \"undef\" (nothing to do) or a HASH\nwhich maps values of uniquekey (see XML::LibXML::Node method \"uniquekey\" onto CODE\nreferences to be called.\n\nOnce the translater from XML into Perl reaches a selected node, it will call your routine\nspecific for that node. That triggering node found is the only parameter. When you return\n\"undef\", the node will not be found in the final result. You may return any data (even the\nnode itself) which will be included in the final result as is, under the name of the\noriginal node.\n\nExample:\n\nmy $out = XMLin $file, HookNodes => \\&protecthtml;\n\nsub protecthtml($$)\n{   # $obj is the instantated XML::Compile::Simple object\n# $xml is a XML::LibXML::Element to get transformed\nmy ($obj, $xml) = @;\n\nmy %hooks;    # collects the table of hooks\n\n# do an xpath search for HTML\nmy $xpc   = XML::LibXML::XPathContext->new($xml);\nmy @nodes = $xpc->findNodes(...); #XXX\n@nodes or return undef;\n\nmy $astext = sub { $[0]->toString(0) };  # as text\n#  $asnode = sub { $[0] };               # as node\n#  $skip    = sub { undef };               # not at all\n\n# the same behavior for all xpath nodes, in this example\n$hook{$->uniquekey} = $astext\nfor @nodes;\n\n\\%hook;\n}\n\nKeepRoot => 1 *# handy*\nIn its attempt to return a data structure free of superfluous detail and unnecessary levels\nof indirection, \"XMLin()\" normally discards the root element name. Setting the 'KeepRoot'\noption to '1' will cause the root element name to be retained. So after executing this code:\n\n$config = XMLin('<config tempdir=\"/tmp\" />', KeepRoot => 1)\n\nYou'll be able to reference the tempdir as \"$config->{config}->{tempdir}\" instead of the\ndefault \"$config->{tempdir}\".\n\nKeyAttr => [ list ] *# important*\nThis option controls the 'array folding' feature which translates nested elements from an\narray to a hash. It also controls the 'unfolding' of hashes to arrays.\n\nFor example, this XML:\n\n<opt>\n<user login=\"grep\" fullname=\"Gary R Epstein\" />\n<user login=\"stty\" fullname=\"Simon T Tyson\" />\n</opt>\n\nwould, by default, parse to this:\n\n{\nuser => [\n{ login    => 'grep',\nfullname => 'Gary R Epstein'\n},\n{ login    => 'stty',\nfullname => 'Simon T Tyson'\n}\n]\n}\n\nIf the option 'KeyAttr => \"login\"' were used to specify that the 'login' attribute is a key,\nthe same XML would parse to:\n\n{\nuser => {\nstty => { fullname => 'Simon T Tyson' },\ngrep => { fullname => 'Gary R Epstein' }\n}\n}\n\nThe key attribute names should be supplied in an arrayref if there is more than one.\n\"XMLin()\" will attempt to match attribute names in the order supplied.\n\nNote 1: The default value for 'KeyAttr' is \"['name', 'key', 'id']\". If you do not want\nfolding on input or unfolding on output you must setting this option to an empty list to\ndisable the feature.\n\nNote 2: If you wish to use this option, you should also enable the \"ForceArray\" option.\nWithout 'ForceArray', a single nested element will be rolled up into a scalar rather than an\narray and therefore will not be folded (since only arrays get folded).\n\nKeyAttr => { list } *# important*\nThis alternative (and preferred) method of specifying the key attributes allows more fine\ngrained control over which elements are folded and on which attributes. For example the\noption 'KeyAttr => { package => 'id' } will cause any package elements to be folded on the\n'id' attribute. No other elements which have an 'id' attribute will be folded at all.\n\nTwo further variations are made possible by prefixing a '+' or a '-' character to the\nattribute name:\n\nThe option 'KeyAttr => { user => \"+login\" }' will cause this XML:\n\n<opt>\n<user login=\"grep\" fullname=\"Gary R Epstein\" />\n<user login=\"stty\" fullname=\"Simon T Tyson\" />\n</opt>\n\nto parse to this data structure:\n\n{\nuser => {\nstty => {\nfullname => 'Simon T Tyson',\nlogin    => 'stty'\n},\ngrep => {\nfullname => 'Gary R Epstein',\nlogin    => 'grep'\n}\n}\n}\n\nThe '+' indicates that the value of the key attribute should be copied rather than moved to\nthe folded hash key.\n\nA '-' prefix would produce this result:\n\n{\nuser => {\nstty => {\nfullname => 'Simon T Tyson',\n-login   => 'stty'\n},\ngrep => {\nfullname => 'Gary R Epstein',\n-login    => 'grep'\n}\n}\n}\n\nNoAttr => 1 *# handy*\nWhen used with \"XMLin()\", any attributes in the XML will be ignored.\n\nNormaliseSpace => 0 | 1 | 2 *# handy*\nThis option controls how whitespace in text content is handled. Recognised values for the\noption are:\n\n\"0\" (default) whitespace is passed through unaltered (except of course for the normalisation\nof whitespace in attribute values which is mandated by the XML recommendation)\n\n\"1\" whitespace is normalised in any value used as a hash key (normalising means removing\nleading and trailing whitespace and collapsing sequences of whitespace characters to a\nsingle space)\n\n\"2\" whitespace is normalised in all text content\n\nNote: you can spell this option with a 'z' if that is more natural for you.\n\nParser => OBJECT\nYou may pass your own XML::LibXML object, in stead of having one created for you. This is\nuseful when you need specific configuration on that object (See XML::LibXML::Parser) or have\nimplemented your own extension to that object.\n\nThe internally created parser object is configured in safe mode. Read the\nXML::LibXML::Parser manual about security issues with certain parameter settings. The\ndefault is unsafe!\n\nParserOpts => HASH|ARRAY\nPass parameters to the creation of a new internal parser object. You can overrule the\noptions which will create a safe parser. It may be more readible to use the \"Parser\"\nparameter.\n\nSearchPath => [ list ] *# handy*\nIf you pass \"XMLin()\" a filename, but the filename include no directory component, you can\nuse this option to specify which directories should be searched to locate the file. You\nmight use this option to search first in the user's home directory, then in a global\ndirectory such as /etc.\n\nIf a filename is provided to \"XMLin()\" but SearchPath is not defined, the file is assumed to\nbe in the current directory.\n\nIf the first parameter to \"XMLin()\" is undefined, the default SearchPath will contain only\nthe directory in which the script itself is located. Otherwise the default SearchPath will\nbe empty.\n\nSuppressEmpty => 1 | '' | undef\n[0.99] What to do with empty elements (no attributes and no content). The default behaviour\nis to represent them as empty hashes. Setting this option to a true value (eg: 1) will cause\nempty elements to be skipped altogether. Setting the option to 'undef' or the empty string\nwill cause empty elements to be represented as the undefined value or the empty string\nrespectively.\n\nValueAttr => [ names ] *# handy*\nUse this option to deal elements which always have a single attribute and no content. Eg:\n\n<opt>\n<colour value=\"red\" />\n<size   value=\"XXL\" />\n</opt>\n\nSetting \"ValueAttr => [ 'value' ]\" will cause the above XML to parse to:\n\n{\ncolour => 'red',\nsize   => 'XXL'\n}\n\ninstead of this (the default):\n\n{\ncolour => { value => 'red' },\nsize   => { value => 'XXL' }\n}\n\nNsExpand => 0 *advised*\nWhen name-spaces are used, the default behavior is to include the prefix in the key name.\nHowever, this is very dangerous: the prefixes can be changed without a change of the XML\nmessage meaning. Therefore, you can better use this \"NsExpand\" option. The downside,\nhowever, is that the labels get very long.\n\nWithout this option:\n\n<record xmlns:x=\"http://xyz\">\n<x:field1>42</x:field1>\n</record>\n<record xmlns:y=\"http://xyz\">\n<y:field1>42</y:field1>\n</record>\n\ntranslates into\n\n{ 'x:field1' => 42 }\n{ 'y:field1' => 42 }\n\nbut both source component have exactly the same meaning. When \"NsExpand\" is used, the result\nis:\n\n{ '{http://xyz}field1' => 42 }\n{ '{http://xyz}field1' => 42 }\n\nOf course, addressing these fields is more work. It is advised to implement it like this:\n\nmy $ns = 'http://xyz';\n$data->{\"{$ns}field1\"};\n\nNsStrip => 0 *sloppy coding*\n[not available in XML::Simple] Namespaces are really important to avoid name collissions,\nbut they are a bit of a hassle. To do it correctly, use option \"NsExpand\". To do it sloppy,\nuse \"NsStrip\". With this option set, the above example will return\n\n{ field1 => 42 }\n{ field1 => 42 }\n",
                "subsections": []
            },
            "EXAMPLES": {
                "content": "When \"XMLin()\" reads the following very simple piece of XML:\n\n<opt username=\"testuser\" password=\"frodo\"></opt>\n\nit returns the following data structure:\n\n{\nusername => 'testuser',\npassword => 'frodo'\n}\n\nThe identical result could have been produced with this alternative XML:\n\n<opt username=\"testuser\" password=\"frodo\" />\n\nOr this (although see 'ForceArray' option for variations):\n\n<opt>\n<username>testuser</username>\n<password>frodo</password>\n</opt>\n\nRepeated nested elements are represented as anonymous arrays:\n\n<opt>\n<person firstname=\"Joe\" lastname=\"Smith\">\n<email>joe@smith.com</email>\n<email>jsmith@yahoo.com</email>\n</person>\n<person firstname=\"Bob\" lastname=\"Smith\">\n<email>bob@smith.com</email>\n</person>\n</opt>\n\n{\nperson => [\n{ email     => [ 'joe@smith.com', 'jsmith@yahoo.com' ],\nfirstname => 'Joe',\nlastname  => 'Smith'\n},\n{ email     => 'bob@smith.com',\nfirstname => 'Bob',\nlastname  => 'Smith'\n}\n]\n}\n\nNested elements with a recognised key attribute are transformed (folded) from an array into a\nhash keyed on the value of that attribute (see the \"KeyAttr\" option):\n\n<opt>\n<person key=\"jsmith\" firstname=\"Joe\" lastname=\"Smith\" />\n<person key=\"tsmith\" firstname=\"Tom\" lastname=\"Smith\" />\n<person key=\"jbloggs\" firstname=\"Joe\" lastname=\"Bloggs\" />\n</opt>\n\n{\nperson => {\njbloggs => {\nfirstname => 'Joe',\nlastname  => 'Bloggs'\n},\ntsmith  => {\nfirstname => 'Tom',\nlastname  => 'Smith'\n},\njsmith => {\nfirstname => 'Joe',\nlastname => 'Smith'\n}\n}\n}\n\nThe <anon> tag can be used to form anonymous arrays:\n\n<opt>\n<head><anon>Col 1</anon><anon>Col 2</anon><anon>Col 3</anon></head>\n<data><anon>R1C1</anon><anon>R1C2</anon><anon>R1C3</anon></data>\n<data><anon>R2C1</anon><anon>R2C2</anon><anon>R2C3</anon></data>\n<data><anon>R3C1</anon><anon>R3C2</anon><anon>R3C3</anon></data>\n</opt>\n\n{\nhead => [ [ 'Col 1', 'Col 2', 'Col 3' ] ],\ndata => [ [ 'R1C1', 'R1C2', 'R1C3' ],\n[ 'R2C1', 'R2C2', 'R2C3' ],\n[ 'R3C1', 'R3C2', 'R3C3' ]\n]\n}\n\nAnonymous arrays can be nested to arbirtrary levels and as a special case, if the surrounding\ntags for an XML document contain only an anonymous array the arrayref will be returned directly\nrather than the usual hashref:\n\n<opt>\n<anon><anon>Col 1</anon><anon>Col 2</anon></anon>\n<anon><anon>R1C1</anon><anon>R1C2</anon></anon>\n<anon><anon>R2C1</anon><anon>R2C2</anon></anon>\n</opt>\n\n[\n[ 'Col 1', 'Col 2' ],\n[ 'R1C1', 'R1C2' ],\n[ 'R2C1', 'R2C2' ]\n]\n\nElements which only contain text content will simply be represented as a scalar. Where an\nelement has both attributes and text content, the element will be represented as a hashref with\nthe text content in the 'content' key (see the \"ContentKey\" option):\n\n<opt>\n<one>first</one>\n<two attr=\"value\">second</two>\n</opt>\n\n{\none => 'first',\ntwo => { attr => 'value', content => 'second' }\n}\n\nMixed content (elements which contain both text content and nested elements) will be not be\nrepresented in a useful way - element order and significant whitespace will be lost. If you need\nto work with mixed content, then XML::Simple is not the right tool for your job - check out the\nnext section.\n",
                "subsections": [
                    {
                        "name": "Differences to XML::Simple",
                        "content": "In general, the output and the options are equivalent, although this module has some differences\nwith XML::Simple to be aware of.\n\nonly XMLin() is supported\nIf you want to write XML then use a schema (for instance with XML::Compile). Do not attempt\nto create XML by hand! If you still think you need it, then have a look at XMLout() as\nimplemented by XML::Simple or any of a zillion template systems.\n\nno \"variables\" option\nIMO, you should use a templating system if you want variables filled-in in the input: it is\nnot a task for this module.\n\nForceArray options\nThere are a few small differences in the result of the \"forcearray\" option, because\nXML::Simple seems to behave inconsequently.\n\nhooks\nXML::Simple does not support hooks.\n"
                    }
                ]
            },
            "SEE ALSO": {
                "content": "XML::Compile for processing XML when a schema is available. When you have a schema, the data and\nstructure of your message get validated.\n\nXML::Simple, the original implementation which interface is followed as closely as possible.\n",
                "subsections": []
            },
            "COPYRIGHTS": {
                "content": "The interface design and large parts of the documentation were taken from the XML::Simple\nmodule, written by Grant McLean <grantm@cpan.org>\n\nCopyrights of the perl code and the related documentation by 2008-2020 by [Mark Overmeer\n<markov@cpan.org>]. For other contributors see ChangeLog.\n\nThis program is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself. See http://dev.perl.org/licenses/\n",
                "subsections": []
            }
        }
    }
}