{"id":7079,"date":"2022-12-20T19:35:12","date_gmt":"2022-12-20T22:35:12","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/xmllibxmlreader-man3\/"},"modified":"2022-12-20T19:35:12","modified_gmt":"2022-12-20T22:35:12","slug":"xmllibxmlreader-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/xmllibxmlreader-man3\/","title":{"rendered":"XML::LibXML::Reader (man3)"},"content":{"rendered":"<h1 align=\"center\">XML::LibXML::Reader<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#CONSTRUCTOR\">CONSTRUCTOR<\/a><br \/> <a href=\"#METHODS CONTROLLING PARSING PROGRESS\">METHODS CONTROLLING PARSING PROGRESS<\/a><br \/> <a href=\"#METHODS EXTRACTING INFORMATION\">METHODS EXTRACTING INFORMATION<\/a><br \/> <a href=\"#METHODS EXTRACTING DOM NODES\">METHODS EXTRACTING DOM NODES<\/a><br \/> <a href=\"#METHODS PROCESSING ATTRIBUTES\">METHODS PROCESSING ATTRIBUTES<\/a><br \/> <a href=\"#OTHER METHODS\">OTHER METHODS<\/a><br \/> <a href=\"#DESTRUCTION\">DESTRUCTION<\/a><br \/> <a href=\"#NODE TYPES\">NODE TYPES<\/a><br \/> <a href=\"#STATES\">STATES<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#ORIGINAL IMPLEMENTATION\">ORIGINAL IMPLEMENTATION<\/a><br \/> <a href=\"#AUTHORS\">AUTHORS<\/a><br \/> <a href=\"#VERSION\">VERSION<\/a><br \/> <a href=\"#COPYRIGHT\">COPYRIGHT<\/a><br \/> <a href=\"#LICENSE\">LICENSE<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">XML::LibXML::Reader \u2212 XML::LibXML::Reader \u2212 interface to libxml2 pull parser<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">use XML::LibXML::Reader; <br \/> my $reader = XML::LibXML::Reader\u2212>new(location => &#8220;file.xml&#8221;) <br \/> or die &#8220;cannot read file.xmln&#8221;; <br \/> while ($reader\u2212>read) { <br \/> processNode($reader); <br \/> } <br \/> sub processNode { <br \/> my $reader = shift; <br \/> printf &#8220;%d %d %s %dn&#8221;, ($reader\u2212>depth, <br \/> $reader\u2212>nodeType, <br \/> $reader\u2212>name, <br \/> $reader\u2212>isEmptyElement); <br \/> }<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">or<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">my $reader = XML::LibXML::Reader\u2212>new(location => &#8220;file.xml&#8221;) <br \/> or die &#8220;cannot read file.xmln&#8221;; <br \/> $reader\u2212>preservePattern(&#8216;\/\/table\/tr&#8217;); <br \/> $reader\u2212>finish; <br \/> print $reader\u2212>document\u2212>toString(1);<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This is a perl interface to libxml2\u2019s pull-parser implementation xmlTextReader <i>http:\/\/xmlsoft.org\/html\/libxml\u2212xmlreader.html<\/i>. This feature requires at least libxml2\u22122.6.21. Pull-parsers (such as StAX in Java, or XmlReader in C#) use an iterator approach to parse <small>XML<\/small> documents. They are easier to program than event-based parser ( <small>SAX<\/small> ) and much more lightweight than tree-based parser ( <small>DOM<\/small> ), which load the complete tree into memory.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The Reader acts as a cursor going forward on the document stream and stopping at each node on the way. At every point, the DOM-like methods of the Reader object allow one to examine the current node (name, namespace, attributes, etc.)<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The user\u2019s code keeps control of the progress and simply calls the &#8220;read()&#8221; function repeatedly to progress to the next node in the document order. Other functions provide means for skipping complete sub-trees, or nodes until a specific element, etc.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">At every time, only a very limited portion of the document is kept in the memory, which makes the <small>API<\/small> more memory-efficient than using <small>DOM.<\/small> However, it is also possible to mix Reader with <small>DOM.<\/small> At every point the user may copy the current node (optionally expanded into a complete sub-tree) from the processed document to another <small>DOM<\/small> tree, or to instruct the Reader to collect sub-document in form of a <small>DOM<\/small> tree consisting of selected nodes.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Reader <small>API<\/small> also supports namespaces, xml:base, entity handling, and <small>DTD<\/small> validation. Schema and RelaxNG validation support will probably be added in some later revision of the Perl interface.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The naming of methods compared to libxml2 and C# XmlTextReader has been changed slightly to match the conventions of XML::LibXML. Some functions have been changed or added with respect to the C interface.<\/p>\n<h2>CONSTRUCTOR <a name=\"CONSTRUCTOR\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Depending on the <small>XML<\/small> source, the Reader object can be created with either of:<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">my $reader = XML::LibXML::Reader\u2212>new( location => &#8220;file.xml&#8221;, &#8230; ); <br \/> my $reader = XML::LibXML::Reader\u2212>new( string => $xml_string, &#8230; ); <br \/> my $reader = XML::LibXML::Reader\u2212>new( IO => $file_handle, &#8230; ); <br \/> my $reader = XML::LibXML::Reader\u2212>new( FD => fileno(STDIN), &#8230; ); <br \/> my $reader = XML::LibXML::Reader\u2212>new( DOM => $dom, &#8230; );<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">where &#8230; are (optional) reader options described below in &#8220;Reader options&#8221; or various parser options described in XML::LibXML::Parser. The constructor recognizes the following <small>XML<\/small> sources:<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Source specification<\/b> <br \/> location<\/p>\n<p style=\"margin-left:17%;\">Read <small>XML<\/small> from a local file or (non-HTTPS) <small>URL.<\/small><\/p>\n<p style=\"margin-left:11%;\">string<\/p>\n<p style=\"margin-left:17%;\">Read <small>XML<\/small> from a string.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"4%\">\n<p><small>IO<\/small><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"83%\">\n<p>Read <small>XML<\/small> a Perl <small>IO<\/small> filehandle.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"4%\">\n<p><small>FD<\/small><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"83%\">\n<p>Read <small>XML<\/small> from a file descriptor (bypasses Perl I\/O layer, only applicable to filehandles for regular files or pipes). Possibly faster than <small>IO.<\/small><\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"4%\">\n<p><small>DOM<\/small><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"83%\">\n<p>Use reader <small>API<\/small> to walk through a pre-parsed XML::LibXML::Document.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Reader options<\/b> <br \/> encoding => $encoding<\/p>\n<p style=\"margin-left:17%;\">override document encoding.<\/p>\n<p style=\"margin-left:11%;\">RelaxNG => $rng_schema<\/p>\n<p style=\"margin-left:17%;\">can be used to pass either a XML::LibXML::RelaxNG object or a filename or (non-HTTPS) <small>URL<\/small> of a RelaxNG schema to the constructor. The schema is then used to validate the document as it is processed.<\/p>\n<p style=\"margin-left:11%;\">Schema => $xsd_schema<\/p>\n<p style=\"margin-left:17%;\">can be used to pass either a XML::LibXML::Schema object or a filename or (non-HTTPS) <small>URL<\/small> of a W3C <small>XSD<\/small> schema to the constructor. The schema is then used to validate the document as it is processed.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"4%\">\n<p>&#8230;<\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"83%\">\n<p>the reader further supports various parser options described in XML::LibXML::Parser (specifically those labeled by \/reader\/).<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<h2>METHODS CONTROLLING PARSING PROGRESS <a name=\"METHODS CONTROLLING PARSING PROGRESS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">read ()<\/p>\n<p style=\"margin-left:17%;\">Moves the position to the next node in the stream, exposing its properties.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Returns 1 if the node was read successfully, 0 if there is no more nodes to read, or \u22121 in case of error<\/p>\n<p style=\"margin-left:11%;\">readAttributeValue ()<\/p>\n<p style=\"margin-left:17%;\">Parses an attribute value into one or more Text and EntityReference nodes.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Returns 1 in case of success, 0 if the reader was not positioned on an attribute node or all the attribute values have been read, or \u22121 in case of error.<\/p>\n<p style=\"margin-left:11%;\">readState ()<\/p>\n<p style=\"margin-left:17%;\">Gets the read state of the reader. Returns the state value, or \u22121 in case of error. The module exports constants for the Reader states, see <small>STATES<\/small> below.<\/p>\n<p style=\"margin-left:11%;\">depth ()<\/p>\n<p style=\"margin-left:17%;\">The depth of the node in the tree, starts at 0 for the root node.<\/p>\n<p style=\"margin-left:11%;\">next ()<\/p>\n<p style=\"margin-left:17%;\">Skip to the node following the current one in the document order while avoiding the sub-tree if any. Returns 1 if the node was read successfully, 0 if there is no more nodes to read, or \u22121 in case of error.<\/p>\n<p style=\"margin-left:11%;\">nextElement (localname?,nsURI?)<\/p>\n<p style=\"margin-left:17%;\">Skip nodes following the current one in the document order until a specific element is reached. The element\u2019s name must be equal to a given localname if defined, and its namespace must equal to a given nsURI if defined. Either of the arguments can be undefined (or omitted, in case of the latter or both).<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Returns 1 if the element was found, 0 if there is no more nodes to read, or \u22121 in case of error.<\/p>\n<p style=\"margin-left:11%;\">nextPatternMatch (compiled_pattern)<\/p>\n<p style=\"margin-left:17%;\">Skip nodes following the current one in the document order until an element matching a given compiled pattern is reached. See XML::LibXML::Pattern for information on compiled patterns. See also the &#8220;matchesPattern&#8221; method.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Returns 1 if the element was found, 0 if there is no more nodes to read, or \u22121 in case of error.<\/p>\n<p style=\"margin-left:11%;\">skipSiblings ()<\/p>\n<p style=\"margin-left:17%;\">Skip all nodes on the same or lower level until the first node on a higher level is reached. In particular, if the current node occurs in an element, the reader stops at the end tag of the parent element, otherwise it stops at a node immediately following the parent node.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Returns 1 if successful, 0 if end of the document is reached, or \u22121 in case of error.<\/p>\n<p style=\"margin-left:11%;\">nextSibling ()<\/p>\n<p style=\"margin-left:17%;\">It skips to the node following the current one in the document order while avoiding the sub-tree if any.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Returns 1 if the node was read successfully, 0 if there is no more nodes to read, or \u22121 in case of error<\/p>\n<p style=\"margin-left:11%;\">nextSiblingElement (name?,nsURI?)<\/p>\n<p style=\"margin-left:17%;\">Like nextElement but only processes sibling elements of the current node (moving forward using &#8220;nextSibling ()&#8221; rather than &#8220;read ()&#8221;, internally).<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Returns 1 if the element was found, 0 if there is no more sibling nodes, or \u22121 in case of error.<\/p>\n<p style=\"margin-left:11%;\">finish ()<\/p>\n<p style=\"margin-left:17%;\">Skip all remaining nodes in the document, reaching end of the document.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Returns 1 if successful, 0 in case of error.<\/p>\n<p style=\"margin-left:11%;\">close ()<\/p>\n<p style=\"margin-left:17%;\">This method releases any resources allocated by the current instance and closes any underlying input. It returns 0 on failure and 1 on success. This method is automatically called by the destructor when the reader is forgotten, therefore you do not have to call it directly.<\/p>\n<h2>METHODS EXTRACTING INFORMATION <a name=\"METHODS EXTRACTING INFORMATION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">name ()<\/p>\n<p style=\"margin-left:17%;\">Returns the qualified name of the current node, equal to (Prefix:)LocalName.<\/p>\n<p style=\"margin-left:11%;\">nodeType ()<\/p>\n<p style=\"margin-left:17%;\">Returns the type of the current node. See <small>NODE TYPES<\/small> below.<\/p>\n<p style=\"margin-left:11%;\">localName ()<\/p>\n<p style=\"margin-left:17%;\">Returns the local name of the node.<\/p>\n<p style=\"margin-left:11%;\">prefix ()<\/p>\n<p style=\"margin-left:17%;\">Returns the prefix of the namespace associated with the node.<\/p>\n<p style=\"margin-left:11%;\">namespaceURI ()<\/p>\n<p style=\"margin-left:17%;\">Returns the <small>URI<\/small> defining the namespace associated with the node.<\/p>\n<p style=\"margin-left:11%;\">isEmptyElement ()<\/p>\n<p style=\"margin-left:17%;\">Check if the current node is empty, this is a bit bizarre in the sense that <a\/> will be considered empty while <a><\/a> will not.<\/p>\n<p style=\"margin-left:11%;\">hasValue ()<\/p>\n<p style=\"margin-left:17%;\">Returns true if the node can have a text value.<\/p>\n<p style=\"margin-left:11%;\">value ()<\/p>\n<p style=\"margin-left:17%;\">Provides the text value of the node if present or undef if not available.<\/p>\n<p style=\"margin-left:11%;\">readInnerXml ()<\/p>\n<p style=\"margin-left:17%;\">Reads the contents of the current node, including child nodes and markup. Returns a string containing the <small>XML<\/small> of the node\u2019s content, or undef if the current node is neither an element nor attribute, or has no child nodes.<\/p>\n<p style=\"margin-left:11%;\">readOuterXml ()<\/p>\n<p style=\"margin-left:17%;\">Reads the contents of the current node, including child nodes and markup.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Returns a string containing the <small>XML<\/small> of the node including its content, or undef if the current node is neither an element nor attribute.<\/p>\n<p style=\"margin-left:11%;\"><b>nodePath()<\/b><\/p>\n<p style=\"margin-left:17%;\">Returns a canonical location path to the current element from the root node to the current node. Namespaced elements are matched by \u2019*\u2019, because there is no way to declare prefixes within XPath patterns. Unlike &#8220;XML::LibXML::Node::nodePath()&#8221;, this function does not provide sibling counts (i.e. instead of e.g. \u2019\/a\/b[1]\u2019 and \u2019\/a\/b[2]\u2019 you get \u2019\/a\/b\u2019 for both matches).<\/p>\n<p style=\"margin-left:11%;\">matchesPattern(compiled_pattern)<\/p>\n<p style=\"margin-left:17%;\">Returns a true value if the current node matches a compiled pattern. See XML::LibXML::Pattern for information on compiled patterns. See also the &#8220;nextPatternMatch&#8221; method.<\/p>\n<h2>METHODS EXTRACTING DOM NODES <a name=\"METHODS EXTRACTING DOM NODES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">document ()<\/p>\n<p style=\"margin-left:17%;\">Provides access to the document tree built by the reader. This function can be used to collect the preserved nodes (see &#8220;preserveNode()&#8221; and preservePattern).<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><small>CAUTION:<\/small> Never use this function to modify the tree unless reading of the whole document is completed!<\/p>\n<p style=\"margin-left:11%;\">copyCurrentNode (deep)<\/p>\n<p style=\"margin-left:17%;\">This function is similar a <small>DOM<\/small> function &#8220;copyNode()&#8221;. It returns a copy of the currently processed node as a corresponding <small>DOM<\/small> object. Use deep = 1 to obtain the full sub-tree.<\/p>\n<p style=\"margin-left:11%;\">preserveNode ()<\/p>\n<p style=\"margin-left:17%;\">This tells the <small>XML<\/small> Reader to preserve the current node in the document tree. A document tree consisting of the preserved nodes and their content can be obtained using the method &#8220;document()&#8221; once parsing is finished.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Returns the node or <small>NULL<\/small> in case of error.<\/p>\n<p style=\"margin-left:11%;\">preservePattern (pattern,%ns_map)<\/p>\n<p style=\"margin-left:17%;\">This tells the <small>XML<\/small> Reader to preserve all nodes matched by the pattern (which is a streaming XPath subset). A document tree consisting of the preserved nodes and their content can be obtained using the method &#8220;document()&#8221; once parsing is finished.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">An optional second argument can be used to provide a <small>HASH<\/small> reference mapping prefixes used by the XPath to namespace URIs.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">The XPath subset available with this function is described at<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">http:\/\/www.w3.org\/TR\/xmlschema\u22121\/#Selector<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">and matches the production<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Path ::= (&#8216;.\/\/&#8217;)? ( Step &#8216;\/&#8217; )* ( Step | &#8216;@&#8217; NameTest )<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Returns a positive number in case of success and \u22121 in case of error<\/p>\n<h2>METHODS PROCESSING ATTRIBUTES <a name=\"METHODS PROCESSING ATTRIBUTES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">attributeCount ()<\/p>\n<p style=\"margin-left:17%;\">Provides the number of attributes of the current node.<\/p>\n<p style=\"margin-left:11%;\">hasAttributes ()<\/p>\n<p style=\"margin-left:17%;\">Whether the node has attributes.<\/p>\n<p style=\"margin-left:11%;\">getAttribute (name)<\/p>\n<p style=\"margin-left:17%;\">Provides the value of the attribute with the specified qualified name.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Returns a string containing the value of the specified attribute, or undef in case of error.<\/p>\n<p style=\"margin-left:11%;\">getAttributeNs (localName, namespaceURI)<\/p>\n<p style=\"margin-left:17%;\">Provides the value of the specified attribute.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Returns a string containing the value of the specified attribute, or undef in case of error.<\/p>\n<p style=\"margin-left:11%;\">getAttributeNo (no)<\/p>\n<p style=\"margin-left:17%;\">Provides the value of the attribute with the specified index relative to the containing element.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Returns a string containing the value of the specified attribute, or undef in case of error.<\/p>\n<p style=\"margin-left:11%;\">isDefault ()<\/p>\n<p style=\"margin-left:17%;\">Returns true if the current attribute node was generated from the default value defined in the <small>DTD.<\/small><\/p>\n<p style=\"margin-left:11%;\">moveToAttribute (name)<\/p>\n<p style=\"margin-left:17%;\">Moves the position to the attribute with the specified local name and namespace <small>URI.<\/small><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Returns 1 in case of success, \u22121 in case of error, 0 if not found<\/p>\n<p style=\"margin-left:11%;\">moveToAttributeNo (no)<\/p>\n<p style=\"margin-left:17%;\">Moves the position to the attribute with the specified index relative to the containing element.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Returns 1 in case of success, \u22121 in case of error, 0 if not found<\/p>\n<p style=\"margin-left:11%;\">moveToAttributeNs (localName,namespaceURI)<\/p>\n<p style=\"margin-left:17%;\">Moves the position to the attribute with the specified local name and namespace <small>URI.<\/small><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Returns 1 in case of success, \u22121 in case of error, 0 if not found<\/p>\n<p style=\"margin-left:11%;\">moveToFirstAttribute ()<\/p>\n<p style=\"margin-left:17%;\">Moves the position to the first attribute associated with the current node.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Returns 1 in case of success, \u22121 in case of error, 0 if not found<\/p>\n<p style=\"margin-left:11%;\">moveToNextAttribute ()<\/p>\n<p style=\"margin-left:17%;\">Moves the position to the next attribute associated with the current node.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Returns 1 in case of success, \u22121 in case of error, 0 if not found<\/p>\n<p style=\"margin-left:11%;\">moveToElement ()<\/p>\n<p style=\"margin-left:17%;\">Moves the position to the node that contains the current attribute node.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Returns 1 in case of success, \u22121 in case of error, 0 if not moved<\/p>\n<p style=\"margin-left:11%;\">isNamespaceDecl ()<\/p>\n<p style=\"margin-left:17%;\">Determine whether the current node is a namespace declaration rather than a regular attribute.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Returns 1 if the current node is a namespace declaration, 0 if it is a regular attribute or other type of node, or \u22121 in case of error.<\/p>\n<h2>OTHER METHODS <a name=\"OTHER METHODS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">lookupNamespace (prefix)<\/p>\n<p style=\"margin-left:17%;\">Resolves a namespace prefix in the scope of the current element.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Returns a string containing the namespace <small>URI<\/small> to which the prefix maps or undef in case of error.<\/p>\n<p style=\"margin-left:11%;\">encoding ()<\/p>\n<p style=\"margin-left:17%;\">Returns a string containing the encoding of the document or undef in case of error.<\/p>\n<p style=\"margin-left:11%;\">standalone ()<\/p>\n<p style=\"margin-left:17%;\">Determine the standalone status of the document being read. Returns 1 if the document was declared to be standalone, 0 if it was declared to be not standalone, or \u22121 if the document did not specify its standalone status or in case of error.<\/p>\n<p style=\"margin-left:11%;\">xmlVersion ()<\/p>\n<p style=\"margin-left:17%;\">Determine the <small>XML<\/small> version of the document being read. Returns a string containing the <small>XML<\/small> version of the document or undef in case of error.<\/p>\n<p style=\"margin-left:11%;\">baseURI ()<\/p>\n<p style=\"margin-left:17%;\">Returns the base <small>URI<\/small> of a given node.<\/p>\n<p style=\"margin-left:11%;\">isValid ()<\/p>\n<p style=\"margin-left:17%;\">Retrieve the validity status from the parser.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Returns 1 if valid, 0 if no, and \u22121 in case of error.<\/p>\n<p style=\"margin-left:11%;\">xmlLang ()<\/p>\n<p style=\"margin-left:17%;\">The xml:lang scope within which the node resides.<\/p>\n<p style=\"margin-left:11%;\">lineNumber ()<\/p>\n<p style=\"margin-left:17%;\">Provide the line number of the current parsing point.<\/p>\n<p style=\"margin-left:11%;\">columnNumber ()<\/p>\n<p style=\"margin-left:17%;\">Provide the column number of the current parsing point.<\/p>\n<p style=\"margin-left:11%;\">byteConsumed ()<\/p>\n<p style=\"margin-left:17%;\">This function provides the current index of the parser relative to the start of the current entity. This function is computed in bytes from the beginning starting at zero and finishing at the size in bytes of the file if parsing a file. The function is of constant cost if the input is <small>UTF\u22128<\/small> but can be costly if run on non\u2212UTF\u22128 input.<\/p>\n<p style=\"margin-left:11%;\">setParserProp (prop => value, &#8230;)<\/p>\n<p style=\"margin-left:17%;\">Change the parser processing behaviour by changing some of its internal properties. The following properties are available with this function: \u2018\u2018load_ext_dtd\u2019\u2019, \u2018\u2018complete_attributes\u2019\u2019, \u2018\u2018validation\u2019\u2019, \u2018\u2018expand_entities\u2019\u2019.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Since some of the properties can only be changed before any read has been done, it is best to set the parsing properties at the constructor.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Returns 0 if the call was successful, or \u22121 in case of error<\/p>\n<p style=\"margin-left:11%;\">getParserProp (prop)<\/p>\n<p style=\"margin-left:17%;\">Get value of an parser internal property. The following property names can be used: \u2018\u2018load_ext_dtd\u2019\u2019, \u2018\u2018complete_attributes\u2019\u2019, \u2018\u2018validation\u2019\u2019, \u2018\u2018expand_entities\u2019\u2019.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Returns the value, usually 0 or 1, or \u22121 in case of error.<\/p>\n<h2>DESTRUCTION <a name=\"DESTRUCTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">XML::LibXML takes care of the reader object destruction when the last reference to the reader object goes out of scope. The document tree is preserved, though, if either of $reader\u2212>document or $reader\u2212>preserveNode was used and references to the document tree exist.<\/p>\n<h2>NODE TYPES <a name=\"NODE TYPES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The reader interface provides the following constants for node types (the constant symbols are exported by default or if tag &#8220;:types&#8221; is used).<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">XML_READER_TYPE_NONE => 0 <br \/> XML_READER_TYPE_ELEMENT => 1 <br \/> XML_READER_TYPE_ATTRIBUTE => 2 <br \/> XML_READER_TYPE_TEXT => 3 <br \/> XML_READER_TYPE_CDATA => 4 <br \/> XML_READER_TYPE_ENTITY_REFERENCE => 5 <br \/> XML_READER_TYPE_ENTITY => 6 <br \/> XML_READER_TYPE_PROCESSING_INSTRUCTION => 7 <br \/> XML_READER_TYPE_COMMENT => 8 <br \/> XML_READER_TYPE_DOCUMENT => 9 <br \/> XML_READER_TYPE_DOCUMENT_TYPE => 10 <br \/> XML_READER_TYPE_DOCUMENT_FRAGMENT => 11 <br \/> XML_READER_TYPE_NOTATION => 12 <br \/> XML_READER_TYPE_WHITESPACE => 13 <br \/> XML_READER_TYPE_SIGNIFICANT_WHITESPACE => 14 <br \/> XML_READER_TYPE_END_ELEMENT => 15 <br \/> XML_READER_TYPE_END_ENTITY => 16 <br \/> XML_READER_TYPE_XML_DECLARATION => 17<\/p>\n<h2>STATES <a name=\"STATES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The following constants represent the values returned by &#8220;readState()&#8221;. They are exported by default, or if tag &#8220;:states&#8221; is used:<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">XML_READER_NONE => \u22121 <br \/> XML_READER_START => 0 <br \/> XML_READER_ELEMENT => 1 <br \/> XML_READER_END => 2 <br \/> XML_READER_EMPTY => 3 <br \/> XML_READER_BACKTRACK => 4 <br \/> XML_READER_DONE => 5 <br \/> XML_READER_ERROR => 6<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">XML::LibXML::Pattern for information about compiled patterns.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">http:\/\/xmlsoft.org\/html\/libxml\u2212xmlreader.html<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">http:\/\/dotgnu.org\/pnetlib\u2212doc\/System\/Xml\/XmlTextReader.html<\/p>\n<h2>ORIGINAL IMPLEMENTATION <a name=\"ORIGINAL IMPLEMENTATION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Heiko Klein, <H.Klein@gmx.net<gt> and Petr Pajas<\/p>\n<h2>AUTHORS <a name=\"AUTHORS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Matt Sergeant, Christian Glahn, Petr Pajas<\/p>\n<h2>VERSION <a name=\"VERSION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">2.0206<\/p>\n<h2>COPYRIGHT <a name=\"COPYRIGHT\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">2001\u22122007, AxKit.com Ltd.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">2002\u22122006, Christian Glahn.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">2006\u22122009, Petr Pajas.<\/p>\n<h2>LICENSE <a name=\"LICENSE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This program is free software; you can redistribute it and\/or modify it under the same terms as Perl itself.<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  XML::LibXML::Reader \u2212 XML::LibXML::Reader \u2212 interface to libxml2 pull parser <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3007,3423],"class_list":["post-7079","post","type-post","status-publish","format-standard","hentry","category-sin-categoria","tag-man3","tag-xmllibxmlreader"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7079","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=7079"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7079\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=7079"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=7079"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=7079"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}