{"id":7071,"date":"2022-12-20T19:35:11","date_gmt":"2022-12-20T22:35:11","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/xmllibxmlattributehash-man3\/"},"modified":"2022-12-20T19:35:11","modified_gmt":"2022-12-20T22:35:11","slug":"xmllibxmlattributehash-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/xmllibxmlattributehash-man3\/","title":{"rendered":"XML::LibXML::AttributeHash (man3)"},"content":{"rendered":"<h1 align=\"center\">XML::LibXML::AttributeHash<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">XML::LibXML::AttributeHash \u2212 tie an XML::LibXML::Element to a hash to access its attributes<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">tie my %hash, &#8216;XML::LibXML::AttributeHash&#8217;, $element; <br \/> $hash{&#8216;href&#8217;} = &#8216;http:\/\/example.com\/&#8217;; <br \/> print $element\u2212>getAttribute(&#8216;href&#8217;) . &#8220;n&#8221;;<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This class allows an element\u2019s attributes to be accessed as if they were a plain old Perl hash. Attribute names become hash keys. Namespaced attributes are keyed using Clark notation.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">my $XLINK = &#8216;http:\/\/www.w3.org\/1999\/xlink&#8217;; <br \/> tie my %hash, &#8216;XML::LibXML::AttributeHash&#8217;, $element; <br \/> $hash{&#8220;{$XLINK}href&#8221;} = &#8216;http:\/\/localhost\/&#8217;; <br \/> print $element\u2212>getAttributeNS($XLINK, &#8216;href&#8217;) . &#8220;n&#8221;;<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">There is rarely any need to use XML::LibXML::AttributeHash directly. In general, it is possible to take advantage of XML::LibXML::Element\u2019s overloading. The example in the <small>SYNOPSIS<\/small> could have been written:<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">$element\u2212>{&#8216;href&#8217;} = &#8216;http:\/\/example.com\/&#8217;; <br \/> print $element\u2212>getAttribute(&#8216;href&#8217;) . &#8220;n&#8221;;<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The tie interface allows the passing of additional arguments to XML::LibXML::AttributeHash:<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">tie my %hash, &#8216;XML::LibXML::AttributeHash&#8217;, $element, %args;<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Currently only one argument is supported, the boolean &#8220;weaken&#8221; which (if true) indicates that the tied object\u2019s reference to the element should be a weak reference. This is used by XML::LibXML::Element\u2019s overloading. The &#8220;weaken&#8221; argument is ignored if you don\u2019t have a working Scalar::Util::weaken.<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  XML::LibXML::AttributeHash \u2212 tie an XML::LibXML::Element to a hash to access its attributes <\/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,3417],"class_list":["post-7071","post","type-post","status-publish","format-standard","hentry","category-sin-categoria","tag-man3","tag-xmllibxmlattributehash"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7071","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=7071"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7071\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=7071"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=7071"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=7071"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}