{
    "mode": "perldoc",
    "parameter": "XML::LibXML::Parser",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/XML%3A%3ALibXML%3A%3AParser/json",
    "generated": "2026-06-11T00:43:55Z",
    "synopsis": "use XML::LibXML '1.70';\n# Parser constructor\n$parser = XML::LibXML->new();\n$parser = XML::LibXML->new(option=>value, ...);\n$parser = XML::LibXML->new({option=>value, ...});\n# Parsing XML\n$dom = XML::LibXML->loadxml(\nlocation => $fileorurl\n# parser options ...\n);\n$dom = XML::LibXML->loadxml(\nstring => $xmlstring\n# parser options ...\n);\n$dom = XML::LibXML->loadxml(\nstring => (\\$xmlstring)\n# parser options ...\n);\n$dom = XML::LibXML->loadxml({\nIO => $perlfilehandle\n# parser options ...\n);\n$dom = $parser->loadxml(...);\n# Parsing HTML\n$dom = XML::LibXML->loadhtml(...);\n$dom = $parser->loadhtml(...);\n# Parsing well-balanced XML chunks\n$fragment = $parser->parsebalancedchunk( $wbxmlstring, $encoding );\n# Processing XInclude\n$parser->processxincludes( $doc );\n$parser->processXIncludes( $doc );\n# Old-style parser interfaces\n$doc = $parser->parsefile( $xmlfilename );\n$doc = $parser->parsefh( $iofh );\n$doc = $parser->parsestring( $xmlstring);\n$doc = $parser->parsehtmlfile( $htmlfile, \\%opts );\n$doc = $parser->parsehtmlfh( $iofh, \\%opts );\n$doc = $parser->parsehtmlstring( $htmlstring, \\%opts );\n# Push parser\n$parser->parsechunk($string, $terminate);\n$parser->initpush();\n$parser->push(@data);\n$doc = $parser->finishpush( $recover );\n# Set/query parser options\n$parser->optionexists($name);\n$parser->getoption($name);\n$parser->setoption($name,$value);\n$parser->setoptions({$name=>$value,...});\n# XML catalogs\n$parser->loadcatalog( $catalogfile );",
    "sections": {
        "NAME": {
            "content": "XML::LibXML::Parser - Parsing XML Data with XML::LibXML\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use XML::LibXML '1.70';\n\n# Parser constructor\n\n$parser = XML::LibXML->new();\n$parser = XML::LibXML->new(option=>value, ...);\n$parser = XML::LibXML->new({option=>value, ...});\n\n# Parsing XML\n\n$dom = XML::LibXML->loadxml(\nlocation => $fileorurl\n# parser options ...\n);\n$dom = XML::LibXML->loadxml(\nstring => $xmlstring\n# parser options ...\n);\n$dom = XML::LibXML->loadxml(\nstring => (\\$xmlstring)\n# parser options ...\n);\n$dom = XML::LibXML->loadxml({\nIO => $perlfilehandle\n# parser options ...\n);\n$dom = $parser->loadxml(...);\n\n# Parsing HTML\n\n$dom = XML::LibXML->loadhtml(...);\n$dom = $parser->loadhtml(...);\n\n# Parsing well-balanced XML chunks\n\n$fragment = $parser->parsebalancedchunk( $wbxmlstring, $encoding );\n\n# Processing XInclude\n\n$parser->processxincludes( $doc );\n$parser->processXIncludes( $doc );\n\n# Old-style parser interfaces\n\n$doc = $parser->parsefile( $xmlfilename );\n$doc = $parser->parsefh( $iofh );\n$doc = $parser->parsestring( $xmlstring);\n$doc = $parser->parsehtmlfile( $htmlfile, \\%opts );\n$doc = $parser->parsehtmlfh( $iofh, \\%opts );\n$doc = $parser->parsehtmlstring( $htmlstring, \\%opts );\n\n# Push parser\n\n$parser->parsechunk($string, $terminate);\n$parser->initpush();\n$parser->push(@data);\n$doc = $parser->finishpush( $recover );\n\n# Set/query parser options\n\n$parser->optionexists($name);\n$parser->getoption($name);\n$parser->setoption($name,$value);\n$parser->setoptions({$name=>$value,...});\n\n# XML catalogs\n\n$parser->loadcatalog( $catalogfile );\n",
            "subsections": []
        },
        "PARSING": {
            "content": "An XML document is read into a data structure such as a DOM tree by a piece of software, called\na parser. XML::LibXML currently provides four different parser interfaces:\n\n*   A DOM Pull-Parser\n\n*   A DOM Push-Parser\n\n*   A SAX Parser\n\n*   A DOM based SAX Parser.\n",
            "subsections": [
                {
                    "name": "Creating a Parser Instance",
                    "content": "XML::LibXML provides an OO interface to the libxml2 parser functions. Thus you have to create a\nparser instance before you can parse any XML data.\n\nnew\n$parser = XML::LibXML->new();\n$parser = XML::LibXML->new(option=>value, ...);\n$parser = XML::LibXML->new({option=>value, ...});\n\nCreate a new XML and HTML parser instance. Each parser instance holds default values for\nvarious parser options. Optionally, one can pass a hash reference or a list of option =>\nvalue pairs to set a different default set of options. Unless specified otherwise, the\noptions \"loadextdtd\", and \"expandentities\" are set to 1. See \"Parser Options\" for a list\nof libxml2 parser's options.\n\nDOM Parser\nOne of the common parser interfaces of XML::LibXML is the DOM parser. This parser reads XML data\ninto a DOM like data structure, so each tag can get accessed and transformed.\n\nXML::LibXML's DOM parser is not only capable to parse XML data, but also (strict) HTML files.\nThere are three ways to parse documents - as a string, as a Perl filehandle, or as a\nfilename/URL. The return value from each is a XML::LibXML::Document object, which is a DOM\nobject.\n\nAll of the functions listed below will throw an exception if the document is invalid. To prevent\nthis causing your program exiting, wrap the call in an eval{} block\n\nloadxml\n$dom = XML::LibXML->loadxml(\nlocation => $fileorurl\n# parser options ...\n);\n$dom = XML::LibXML->loadxml(\nstring => $xmlstring\n# parser options ...\n);\n$dom = XML::LibXML->loadxml(\nstring => (\\$xmlstring)\n# parser options ...\n);\n$dom = XML::LibXML->loadxml({\nIO => $perlfilehandle\n# parser options ...\n);\n$dom = $parser->loadxml(...);\n\nThis function is available since XML::LibXML 1.70. It provides easy to use interface to the\nXML parser that parses given file (or URL), string, or input stream to a DOM tree. The\narguments can be passed in a HASH reference or as name => value pairs. The function can be\ncalled as a class method or an object method. In both cases it internally creates a new\nparser instance passing the specified parser options; if called as an object method, it\nclones the original parser (preserving its settings) and additionally applies the specified\noptions to the new parser. See the constructor \"new\" and \"Parser Options\" for more\ninformation.\n\nloadhtml\n$dom = XML::LibXML->loadhtml(...);\n$dom = $parser->loadhtml(...);\n\nThis function is available since XML::LibXML 1.70. It has the same usage as \"loadxml\",\nproviding interface to the HTML parser. See \"loadxml\" for more information.\n\nParsing HTML may cause problems, especially if the ampersand ('&') is used. This is a common\nproblem if HTML code is parsed that contains links to CGI-scripts. Such links cause the parser\nto throw errors. In such cases libxml2 still parses the entire document as there was no error,\nbut the error causes XML::LibXML to stop the parsing process. However, the document is not lost.\nSuch HTML documents should be parsed using the *recover* flag. By default recovering is\ndeactivated.\n\nThe functions described above are implemented to parse well formed documents. In some cases a\nprogram gets well balanced XML instead of well formed documents (e.g. an XML fragment from a\ndatabase). With XML::LibXML it is not required to wrap such fragments in the code, because\nXML::LibXML is capable even to parse well balanced XML fragments.\n\nparsebalancedchunk\n$fragment = $parser->parsebalancedchunk( $wbxmlstring, $encoding );\n\nThis function parses a well balanced XML string into a XML::LibXML::DocumentFragment. The\nfirst arguments contains the input string, the optional second argument can be used to\nspecify character encoding of the input (UTF-8 is assumed by default).\n\nparsexmlchunk\nThis is the old name of parsebalancedchunk(). Because it may causes confusion with the\npush parser interface, this function should not be used anymore.\n\nBy default XML::LibXML does not process XInclude tags within an XML Document (see options\nsection below). XML::LibXML allows one to post-process a document to expand XInclude tags.\n\nprocessxincludes\n$parser->processxincludes( $doc );\n\nAfter a document is parsed into a DOM structure, you may want to expand the documents\nXInclude tags. This function processes the given document structure and expands all XInclude\ntags (or throws an error) by using the flags and callbacks of the given parser instance.\n\nNote that the resulting Tree contains some extra nodes (of type XMLXINCLUDESTART and\nXMLXINCLUDEEND) after successfully processing the document. These nodes indicate where\ndata was included into the original tree. if the document is serialized, these extra nodes\nwill not show up.\n\nRemember: A Document with processed XIncludes differs from the original document after\nserialization, because the original XInclude tags will not get restored!\n\nIf the parser flag \"expandxincludes\" is set to 1, you need not to post process the parsed\ndocument.\n\nprocessXIncludes\n$parser->processXIncludes( $doc );\n\nThis is an alias to processxincludes, but through a JAVA like function name.\n\nparsefile\n$doc = $parser->parsefile( $xmlfilename );\n\nThis function parses an XML document from a file or network; $xmlfilename can be either a\nfilename or an URL. Note that for parsing files, this function is the fastest choice, about\n6-8 times faster then parsefh().\n\nparsefh\n$doc = $parser->parsefh( $iofh );\n\nparsefh() parses a IOREF or a subclass of IO::Handle.\n\nBecause the data comes from an open handle, libxml2's parser does not know about the base\nURI of the document. To set the base URI one should use parsefh() as follows:\n\nmy $doc = $parser->parsefh( $iofh, $baseuri );\n\nparsestring\n$doc = $parser->parsestring( $xmlstring);\n\nThis function is similar to parsefh(), but it parses an XML document that is available as a\nsingle string in memory, or alternatively as a reference to a scalar containing a string.\nAgain, you can pass an optional base URI to the function.\n\nmy $doc = $parser->parsestring( $xmlstring, $baseuri );\nmy $doc = $parser->parsestring(\\$xmlstring, $baseuri);\n\nparsehtmlfile\n$doc = $parser->parsehtmlfile( $htmlfile, \\%opts );\n\nSimilar to parsefile() but parses HTML (strict) documents; $htmlfile can be filename or\nURL.\n\nAn optional second argument can be used to pass some options to the HTML parser as a HASH\nreference. See options labeled with HTML in \"Parser Options\".\n\nparsehtmlfh\n$doc = $parser->parsehtmlfh( $iofh, \\%opts );\n\nSimilar to parsefh() but parses HTML (strict) streams.\n\nAn optional second argument can be used to pass some options to the HTML parser as a HASH\nreference. See options labeled with HTML in \"Parser Options\".\n\nNote: encoding option may not work correctly with this function in libxml2 < 2.6.27 if the\nHTML file declares charset using a META tag.\n\nparsehtmlstring\n$doc = $parser->parsehtmlstring( $htmlstring, \\%opts );\n\nSimilar to parsestring() but parses HTML (strict) strings.\n\nAn optional second argument can be used to pass some options to the HTML parser as a HASH\nreference. See options labeled with HTML in \"Parser Options\".\n"
                },
                {
                    "name": "Push Parser",
                    "content": "XML::LibXML provides a push parser interface. Rather than pulling the data from a given source\nthe push parser waits for the data to be pushed into it.\n\nThis allows one to parse large documents without waiting for the parser to finish. The interface\nis especially useful if a program needs to pre-process the incoming pieces of XML (e.g. to\ndetect document boundaries).\n\nWhile XML::LibXML parse*() functions force the data to be a well-formed XML, the push parser\nwill take any arbitrary string that contains some XML data. The only requirement is that all the\npushed strings are together a well formed document. With the push parser interface a program can\ninterrupt the parsing process as required, where the parse*() functions give not enough\nflexibility.\n\nDifferent to the pull parser implemented in parsefh() or parsefile(), the push parser is not\nable to find out about the documents end itself. Thus the calling program needs to indicate\nexplicitly when the parsing is done.\n\nIn XML::LibXML this is done by a single function:\n\nparsechunk\n$parser->parsechunk($string, $terminate);\n\nparsechunk() tries to parse a given chunk of data, which isn't necessarily well balanced\ndata. The function takes two parameters: The chunk of data as a string and optional a\ntermination flag. If the termination flag is set to a true value (e.g. 1), the parsing will\nbe stopped and the resulting document will be returned as the following example describes:\n\nmy $parser = XML::LibXML->new;\nfor my $string ( \"<\", \"foo\", ' bar=\"hello world\"', \"/>\") {\n$parser->parsechunk( $string );\n}\nmy $doc = $parser->parsechunk(\"\", 1); # terminate the parsing\n\nInternally XML::LibXML provides three functions that control the push parser process:\n\ninitpush\n$parser->initpush();\n\nInitializes the push parser.\n\npush\n$parser->push(@data);\n\nThis function pushes the data stored inside the array to libxml2's parser. Each entry in\n@data must be a normal scalar! This method can be called repeatedly.\n\nfinishpush\n$doc = $parser->finishpush( $recover );\n\nThis function returns the result of the parsing process. If this function is called without\na parameter it will complain about non well-formed documents. If $restore is 1, the push\nparser can be used to restore broken or non well formed (XML) documents as the following\nexample shows:\n\neval {\n$parser->push( \"<foo>\", \"bar\" );\n$doc = $parser->finishpush();    # will report broken XML\n};\nif ( $@ ) {\n# ...\n}\n\nThis can be annoying if the closing tag is missed by accident. The following code will\nrestore the document:\n\neval {\n$parser->push( \"<foo>\", \"bar\" );\n$doc = $parser->finishpush(1);   # will return the data parsed\n# unless an error happened\n};\n\nprint $doc->toString(); # returns \"<foo>bar</foo>\"\n\nOf course finishpush() will return nothing if there was no data pushed to the parser\nbefore.\n\nPull Parser (Reader)\nXML::LibXML also provides a pull-parser interface similar to the XmlReader interface in .NET.\nThis interface is almost streaming, and is usually faster and simpler to use than SAX. See\nXML::LibXML::Reader.\n"
                },
                {
                    "name": "Direct SAX Parser",
                    "content": "XML::LibXML provides a direct SAX parser in the XML::LibXML::SAX module.\n\nDOM based SAX Parser\nXML::LibXML also provides a DOM based SAX parser. The SAX parser is defined in the module\nXML::LibXML::SAX::Parser. As it is not a stream based parser, it parses documents into a DOM and\ntraverses the DOM tree instead.\n\nThe API of this parser is exactly the same as any other Perl SAX2 parser. See XML::SAX::Intro\nfor details.\n\nAside from the regular parsing methods, you can access the DOM tree traverser directly, using\nthe generate() method:\n\nmy $doc = buildyourselfadocument();\nmy $saxparser = $XML::LibXML::SAX::Parser->new( ... );\n$parser->generate( $doc );\n\nThis is useful for serializing DOM trees, for example that you might have done prior processing\non, or that you have as a result of XSLT processing.\n\n*WARNING*\n\nThis is NOT a streaming SAX parser. As I said above, this parser reads the entire document into\na DOM and serialises it. Some people couldn't read that in the paragraph above so I've added\nthis warning. If you want a streaming SAX parser look at the XML::LibXML::SAX man page\n"
                }
            ]
        },
        "SERIALIZATION": {
            "content": "XML::LibXML provides some functions to serialize nodes and documents. The serialization\nfunctions are described on the XML::LibXML::Node manpage or the XML::LibXML::Document manpage.\nXML::LibXML checks three global flags that alter the serialization process:\n\n*   skipXMLDeclaration\n\n*   skipDTD\n\n*   setTagCompression\n\nof that three functions only setTagCompression is available for all serialization functions.\n\nBecause XML::LibXML does these flags not itself, one has to define them locally as the following\nexample shows:\n\nlocal $XML::LibXML::skipXMLDeclaration = 1;\nlocal $XML::LibXML::skipDTD = 1;\nlocal $XML::LibXML::setTagCompression = 1;\n\nIf skipXMLDeclaration is defined and not '0', the XML declaration is omitted during\nserialization.\n\nIf skipDTD is defined and not '0', an existing DTD would not be serialized with the document.\n\nIf setTagCompression is defined and not '0' empty tags are displayed as open and closing tags\nrather than the shortcut. For example the empty tag *foo* will be rendered as *<foo></foo>*\nrather than *<foo/>*.\n",
            "subsections": []
        },
        "PARSER OPTIONS": {
            "content": "Handling of libxml2 parser options has been unified and improved in XML::LibXML 1.70. You can\nnow set default options for a particular parser instance by passing them to the constructor as\n\"XML::LibXML->new({name=>value, ...})\" or \"XML::LibXML->new(name=>value,...)\". The options can\nbe queried and changed using the following methods (pre-1.70 interfaces such as\n\"$parser->loadextdtd(0)\" also exist, see below):\n\noptionexists\n$parser->optionexists($name);\n\nReturns 1 if the current XML::LibXML version supports the option $name, otherwise returns 0\n(note that this does not necessarily mean that the option is supported by the underlying\nlibxml2 library).\n\ngetoption\n$parser->getoption($name);\n\nReturns the current value of the parser option $name.\n\nsetoption\n$parser->setoption($name,$value);\n\nSets option $name to value $value.\n\nsetoptions\n$parser->setoptions({$name=>$value,...});\n\nSets multiple parsing options at once.\n\nIMPORTANT NOTE: This documentation reflects the parser flags available in libxml2 2.7.3. Some\noptions have no effect if an older version of libxml2 is used.\n\nEach of the flags listed below is labeled\n\n/parser/\nif it can be used with a \"XML::LibXML\" parser object (i.e. passed to \"XML::LibXML->new\",\n\"XML::LibXML->setoption\", etc.)\n\n/html/\nif it can be used passed to the \"parsehtml*\" methods\n\n/reader/\nif it can be used with the \"XML::LibXML::Reader\".\n\nUnless specified otherwise, the default for boolean valued options is 0 (false).\n\nThe available options are:\n\nURI /parser, html, reader/\n\nIn case of parsing strings or file handles, XML::LibXML doesn't know about the base uri of\nthe document. To make relative references such as XIncludes work, one has to set a base URI,\nthat is then used for the parsed document.\n\nlinenumbers\n/parser, html, reader/\n\nIf this option is activated, libxml2 will store the line number of each element node in the\nparsed document. The line number can be obtained using the \"linenumber()\" method of the\n\"XML::LibXML::Node\" class (for non-element nodes this may report the line number of the\ncontaining element). The line numbers are also used for reporting positions of validation\nerrors.\n\nIMPORTANT: Due to limitations in the libxml2 library line numbers greater than 65535 will be\nreturned as 65535. Unfortunately, this is a long and sad story, please see\n<http://bugzilla.gnome.org/showbug.cgi?id=325533> for more details.\n\nencoding\n/html/\n\ncharacter encoding of the input\n\nrecover\n/parser, html, reader/\n\nrecover from errors; possible values are 0, 1, and 2\n\nA true value turns on recovery mode which allows one to parse broken XML or HTML data. The\nrecovery mode allows the parser to return the successfully parsed portion of the input\ndocument. This is useful for almost well-formed documents, where for example a closing tag\nis missing somewhere. Still, XML::LibXML will only parse until the first fatal\n(non-recoverable) error occurs, reporting recoverable parsing errors as warnings. To\nsuppress even these warnings, use recover=>2.\n\nNote that validation is switched off automatically in recovery mode.\n\nexpandentities\n/parser, reader/\n\nsubstitute entities; possible values are 0 and 1; default is 1\n\nNote that although this flag disables entity substitution, it does not prevent the parser\nfrom loading external entities; when substitution of an external entity is disabled, the\nentity will be represented in the document tree by an XMLENTITYREFNODE node whose subtree\nwill be the content obtained by parsing the external resource; Although this nesting is\nvisible from the DOM it is transparent to XPath data model, so it is possible to match nodes\nin an unexpanded entity by the same XPath expression as if the entity were expanded. See\nalso extenthandler.\n\nextenthandler\n/parser/\n\nProvide a custom external entity handler to be used when expandentities is set to 1.\nPossible value is a subroutine reference.\n\nThis feature does not work properly in libxml2 < 2.6.27!\n\nThe subroutine provided is called whenever the parser needs to retrieve the content of an\nexternal entity. It is called with two arguments: the system ID (URI) and the public ID. The\nvalue returned by the subroutine is parsed as the content of the entity.\n\nThis method can be used to completely disable entity loading, e.g. to prevent exploits of\nthe type described at\n(<http://searchsecuritychannel.techtarget.com/generic/0,295582,sid97gci1304703,00.html>),\nwhere a service is tricked to expose its private data by letting it parse a remote file (RSS\nfeed) that contains an entity reference to a local file (e.g. \"/etc/fstab\").\n\nA more granular solution to this problem, however, is provided by custom URL resolvers, as\nin\n\nmy $c = XML::LibXML::InputCallback->new();\nsub match {   # accept file:/ URIs except for XML catalogs in /etc/xml/\nmy ($uri) = @;\nreturn ($uri=~m{^file:/}\nand $uri !~ m{^file:///etc/xml/})\n? 1 : 0;\n}\n$c->registercallbacks([ \\&match, sub{}, sub{}, sub{} ]);\n$parser->inputcallbacks($c);\n\nloadextdtd\n/parser, reader/\n\nload the external DTD subset while parsing; possible values are 0 and 1. Unless specified,\nXML::LibXML sets this option to 1.\n\nThis flag is also required for DTD Validation, to provide complete attribute, and to expand\nentities, regardless if the document has an internal subset. Thus switching off external DTD\nloading, will disable entity expansion, validation, and complete attributes on internal\nsubsets as well.\n\ncompleteattributes\n/parser, reader/\n\ncreate default DTD attributes; possible values are 0 and 1\n\nvalidation\n/parser, reader/\n\nvalidate with the DTD; possible values are 0 and 1\n\nsuppresserrors\n/parser, html, reader/\n\nsuppress error reports; possible values are 0 and 1\n\nsuppresswarnings\n/parser, html, reader/\n\nsuppress warning reports; possible values are 0 and 1\n\npedanticparser\n/parser, html, reader/\n\npedantic error reporting; possible values are 0 and 1\n\nnoblanks\n/parser, html, reader/\n\nremove blank nodes; possible values are 0 and 1\n\nnodefdtd\n/html/\n\ndo not add a default DOCTYPE; possible values are 0 and 1\n\nthe default is (0) to add a DTD when the input html lacks one\n\nexpandxinclude or xinclude\n/parser, reader/\n\nImplement XInclude substitution; possible values are 0 and 1\n\nExpands XInclude tags immediately while parsing the document. Note that the parser will use\nthe URI resolvers installed via \"XML::LibXML::InputCallback\" to parse the included document\n(if any).\n\nnoxincludenodes\n/parser, reader/\n\ndo not generate XINCLUDE START/END nodes; possible values are 0 and 1\n\nnonetwork\n/parser, html, reader/\n\nForbid network access; possible values are 0 and 1\n\nIf set to true, all attempts to fetch non-local resources (such as DTD or external entities)\nwill fail (unless custom callbacks are defined).\n\nIt may be necessary to use the flag \"recover\" for processing documents requiring such\nresources while networking is off.\n\ncleannamespaces\n/parser, reader/\n\nremove redundant namespaces declarations during parsing; possible values are 0 and 1.\n\nnocdata\n/parser, html, reader/\n\nmerge CDATA as text nodes; possible values are 0 and 1\n\nnobasefix\n/parser, reader/\n\nnot fixup XINCLUDE xml#base URIS; possible values are 0 and 1\n\nhuge\n/parser, html, reader/\n\nrelax any hardcoded limit from the parser; possible values are 0 and 1. Unless specified,\nXML::LibXML sets this option to 0.\n\nNote: the default value for this option was changed to protect against denial of service\nthrough entity expansion attacks. Before enabling the option ensure you have taken\nalternative measures to protect your application against this type of attack.\n\ngdome\n/parser/\n\nTHIS OPTION IS EXPERIMENTAL!\n\nAlthough quite powerful, XML::LibXML's DOM implementation is incomplete with respect to the\nDOM level 2 or level 3 specifications. XML::GDOME is based on libxml2 as well, and provides\na rather complete DOM implementation by wrapping libgdome. This flag allows you to make use\nof XML::LibXML's full parser options and XML::GDOME's DOM implementation at the same time.\n\nTo make use of this function, one has to install libgdome and configure XML::LibXML to use\nthis library. For this you need to rebuild XML::LibXML!\n\nNote: this feature was not seriously tested in recent XML::LibXML releases.\n\nFor compatibility with XML::LibXML versions prior to 1.70, the following methods are also\nsupported for querying and setting the corresponding parser options (if called without\narguments, the methods return the current value of the corresponding parser options; with an\nargument sets the option to a given value):\n\n$parser->validation();\n$parser->recover();\n$parser->pedanticparser();\n$parser->linenumbers();\n$parser->loadextdtd();\n$parser->completeattributes();\n$parser->expandxinclude();\n$parser->gdomedom();\n$parser->cleannamespaces();\n$parser->nonetwork();\n\nThe following obsolete methods trigger parser options in some special way:\n\nrecoversilently\n$parser->recoversilently(1);\n\nIf called without an argument, returns true if the current value of the \"recover\" parser\noption is 2 and returns false otherwise. With a true argument sets the \"recover\" parser\noption to 2; with a false argument sets the \"recover\" parser option to 0.\n\nexpandentities\n$parser->expandentities(0);\n\nGet/set the \"expandentities\" option. If called with a true argument, also turns the\n\"loadextdtd\" option to 1.\n\nkeepblanks\n$parser->keepblanks(0);\n\nThis is actually the opposite of the \"noblanks\" parser option. If used without an argument\nretrieves negated value of \"noblanks\". If used with an argument sets \"noblanks\" to the\nopposite value.\n\nbaseuri\n$parser->baseuri( $yourbaseuri );\n\nGet/set the \"URI\" option.\n",
            "subsections": []
        },
        "XML CATALOGS": {
            "content": "\"libxml2\" supports XML catalogs. Catalogs are used to map remote resources to their local\ncopies. Using catalogs can speed up parsing processes if many external resources from remote\naddresses are loaded into the parsed documents (such as DTDs or XIncludes).\n\nNote that libxml2 has a global pool of loaded catalogs, so if you apply the method\n\"loadcatalog\" to one parser instance, all parser instances will start using the catalog (in\naddition to other previously loaded catalogs).\n\nNote also that catalogs are not used when a custom external entity handler is specified. At the\ncurrent state it is not possible to make use of both types of resolving systems at the same\ntime.\n\nloadcatalog\n$parser->loadcatalog( $catalogfile );\n\nLoads the XML catalog file $catalogfile.\n\n# Global external entity loader (similar to extenthandler option\n# but this works really globally, also in XML::LibXSLT include etc..)\n\nXML::LibXML::externalEntityLoader(\\&myloader);\n",
            "subsections": []
        },
        "ERROR REPORTING": {
            "content": "XML::LibXML throws exceptions during parsing, validation or XPath processing (and some other\noccasions). These errors can be caught by using *eval* blocks. The error is stored in *$@*.\nThere are two implementations: the old one throws $@ which is just a message string, in the new\none $@ is an object from the class XML::LibXML::Error; this class overrides the operator \"\" so\nthat when printed, the object flattens to the usual error message.\n\nXML::LibXML throws errors as they occur. This is a very common misunderstanding in the use of\nXML::LibXML. If the eval is omitted, XML::LibXML will always halt your script by \"croaking\" (see\nCarp man page for details).\n\nAlso note that an increasing number of functions throw errors if bad data is passed as\narguments. If you cannot assure valid data passed to XML::LibXML you should eval these\nfunctions.\n\nNote: since version 1.59, getlasterror() is no longer available in XML::LibXML for\nthread-safety reasons.\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": []
        }
    },
    "summary": "XML::LibXML::Parser - Parsing XML Data with XML::LibXML",
    "flags": [],
    "examples": [],
    "see_also": []
}