{
    "content": [
        {
            "type": "text",
            "text": "# XML::LibXML::Error (perldoc)\n\n## NAME\n\nXML::LibXML::Error - Structured Errors\n\n## SYNOPSIS\n\neval { ... };\nif (ref($@)) {\n# handle a structured error (XML::LibXML::Error object)\n} elsif ($@) {\n# error, but not an XML::LibXML::Error object\n} else {\n# no error\n}\n$XML::LibXML::Error::WARNINGS=1;\n$message = $@->asstring();\nprint $@->dump();\n$errordomain = $@->domain();\n$errorcode = $@->code();\n$errormessage = $@->message();\n$errorlevel = $@->level();\n$filename = $@->file();\n$line = $@->line();\n$nodename = $@->nodename();\n$errorstr1 = $@->str1();\n$errorstr2 = $@->str2();\n$errorstr3 = $@->str3();\n$errornum1 = $@->num1();\n$errornum2 = $@->num2();\n$string = $@->context();\n$offset = $@->column();\n$previouserror = $@->prev();\n\n## DESCRIPTION\n\nThe XML::LibXML::Error class is a tiny frontend to *libxml2*'s structured error support. If\nXML::LibXML is compiled with structured error support, all errors reported by libxml2 are\ntransformed to XML::LibXML::Error objects. These objects automatically serialize to the\ncorresponding error messages when printed or used in a string operation, but as objects, can\nalso be used to get a detailed and structured information about the error that occurred.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **AUTHORS**\n- **VERSION**\n- **COPYRIGHT**\n- **LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "XML::LibXML::Error",
        "section": "",
        "mode": "perldoc",
        "summary": "XML::LibXML::Error - Structured Errors",
        "synopsis": "eval { ... };\nif (ref($@)) {\n# handle a structured error (XML::LibXML::Error object)\n} elsif ($@) {\n# error, but not an XML::LibXML::Error object\n} else {\n# no error\n}\n$XML::LibXML::Error::WARNINGS=1;\n$message = $@->asstring();\nprint $@->dump();\n$errordomain = $@->domain();\n$errorcode = $@->code();\n$errormessage = $@->message();\n$errorlevel = $@->level();\n$filename = $@->file();\n$line = $@->line();\n$nodename = $@->nodename();\n$errorstr1 = $@->str1();\n$errorstr2 = $@->str2();\n$errorstr3 = $@->str3();\n$errornum1 = $@->num1();\n$errornum2 = $@->num2();\n$string = $@->context();\n$offset = $@->column();\n$previouserror = $@->prev();",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 28,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 134,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "LICENSE",
                "lines": 3,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "XML::LibXML::Error - Structured Errors\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "eval { ... };\nif (ref($@)) {\n# handle a structured error (XML::LibXML::Error object)\n} elsif ($@) {\n# error, but not an XML::LibXML::Error object\n} else {\n# no error\n}\n\n$XML::LibXML::Error::WARNINGS=1;\n$message = $@->asstring();\nprint $@->dump();\n$errordomain = $@->domain();\n$errorcode = $@->code();\n$errormessage = $@->message();\n$errorlevel = $@->level();\n$filename = $@->file();\n$line = $@->line();\n$nodename = $@->nodename();\n$errorstr1 = $@->str1();\n$errorstr2 = $@->str2();\n$errorstr3 = $@->str3();\n$errornum1 = $@->num1();\n$errornum2 = $@->num2();\n$string = $@->context();\n$offset = $@->column();\n$previouserror = $@->prev();\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "The XML::LibXML::Error class is a tiny frontend to *libxml2*'s structured error support. If\nXML::LibXML is compiled with structured error support, all errors reported by libxml2 are\ntransformed to XML::LibXML::Error objects. These objects automatically serialize to the\ncorresponding error messages when printed or used in a string operation, but as objects, can\nalso be used to get a detailed and structured information about the error that occurred.\n\nUnlike most other XML::LibXML objects, XML::LibXML::Error doesn't wrap an underlying *libxml2*\nstructure directly, but rather transforms it to a blessed Perl hash reference containing the\nindividual fields of the structured error information as hash key-value pairs. Individual items\n(fields) of a structured error can either be obtained directly as $@->{field}, or using\nautoloaded methods such as $@->field() (where field is the field name). XML::LibXML::Error\nobjects have the following fields: domain, code, level, file, line, nodename, message, str1,\nstr2, str3, num1, num2, and prev (some of them may be undefined).\n\n$XML::LibXML::Error::WARNINGS\n$XML::LibXML::Error::WARNINGS=1;\n\nTraditionally, XML::LibXML was suppressing parser warnings by setting libxml2's global\nvariable xmlGetWarningsDefaultValue to 0. Since 1.70 we do not change libxml2's global\nvariables anymore; for backward compatibility, XML::LibXML suppresses warnings. This\nvariable can be set to 1 to enable reporting of these warnings via Perl \"warn\" and to 2 to\nreport hem via \"die\".\n\nasstring\n$message = $@->asstring();\n\nThis function serializes an XML::LibXML::Error object to a string containing the full error\nmessage close to the message produced by *libxml2* default error handlers and tools like\nxmllint. This method is also used to overload \"\" operator on XML::LibXML::Error, so it is\nautomatically called whenever XML::LibXML::Error object is treated as a string (e.g. in\nprint $@).\n\ndump\nprint $@->dump();\n\nThis function serializes an XML::LibXML::Error to a string displaying all fields of the\nerror structure individually on separate lines of the form 'name' => 'value'.\n\ndomain\n$errordomain = $@->domain();\n\nReturns string containing information about what part of the library raised the error. Can\nbe one of: \"parser\", \"tree\", \"namespace\", \"validity\", \"HTML parser\", \"memory\", \"output\",\n\"I/O\", \"ftp\", \"http\", \"XInclude\", \"XPath\", \"xpointer\", \"regexp\", \"Schemas datatype\",\n\"Schemas parser\", \"Schemas validity\", \"Relax-NG parser\", \"Relax-NG validity\", \"Catalog\",\n\"C14N\", \"XSLT\", \"validity\".\n\ncode\n$errorcode = $@->code();\n\nReturns the actual libxml2 error code. The XML::LibXML::ErrNo module defines constants for\nindividual error codes. Currently libxml2 uses over 480 different error codes.\n\nmessage\n$errormessage = $@->message();\n\nReturns a human-readable informative error message.\n\nlevel\n$errorlevel = $@->level();\n\nReturns an integer value describing how consequent is the error. XML::LibXML::Error defines\nthe following constants:\n\n*   XMLERRNONE = 0\n\n*   XMLERRWARNING = 1 : A simple warning.\n\n*   XMLERRERROR = 2 : A recoverable error.\n\n*   XMLERRFATAL = 3 : A fatal error.\n\nfile\n$filename = $@->file();\n\nReturns the filename of the file being processed while the error occurred.\n\nline\n$line = $@->line();\n\nThe line number, if available.\n\nnodename\n$nodename = $@->nodename();\n\nName of the node where error occurred, if available. When this field is non-empty, libxml2\nactually returned a physical pointer to the specified node. Due to memory management issues,\nit is very difficult to implement a way to expose the pointer to the Perl level as a\nXML::LibXML::Node. For this reason, XML::LibXML::Error currently only exposes the name the\nnode.\n\nstr1\n$errorstr1 = $@->str1();\n\nError specific. Extra string information.\n\nstr2\n$errorstr2 = $@->str2();\n\nError specific. Extra string information.\n\nstr3\n$errorstr3 = $@->str3();\n\nError specific. Extra string information.\n\nnum1\n$errornum1 = $@->num1();\n\nError specific. Extra numeric information.\n\nnum2\n$errornum2 = $@->num2();\n\nIn recent libxml2 versions, this value contains a column number of the error or 0 if N/A.\n\ncontext\n$string = $@->context();\n\nFor parsing errors, this field contains about 80 characters of the XML near the place where\nthe error occurred. The field \"$@->column()\" contains the corresponding offset. Where N/A,\nthe field is undefined.\n\ncolumn\n$offset = $@->column();\n\nSee \"$@->column()\" above.\n\nprev\n$previouserror = $@->prev();\n\nThis field can possibly hold a reference to another XML::LibXML::Error object representing\nan error which occurred just before this error.\n",
                "subsections": []
            },
            "AUTHORS": {
                "content": "Matt Sergeant, Christian Glahn, Petr Pajas\n",
                "subsections": []
            },
            "VERSION": {
                "content": "2.0134\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "2001-2007, AxKit.com Ltd.\n\n2002-2006, Christian Glahn.\n\n2006-2009, Petr Pajas.\n",
                "subsections": []
            },
            "LICENSE": {
                "content": "This program is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n",
                "subsections": []
            }
        }
    }
}