{
    "mode": "perldoc",
    "parameter": "XML::LibXML::AttributeHash",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/XML%3A%3ALibXML%3A%3AAttributeHash/json",
    "generated": "2026-06-11T23:15:20Z",
    "synopsis": "tie my %hash, 'XML::LibXML::AttributeHash', $element;\n$hash{'href'} = 'http://example.com/';\nprint $element->getAttribute('href') . \"\\n\";",
    "sections": {
        "NAME": {
            "content": "XML::LibXML::AttributeHash - tie an XML::LibXML::Element to a hash to access its attributes\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "tie my %hash, 'XML::LibXML::AttributeHash', $element;\n$hash{'href'} = 'http://example.com/';\nprint $element->getAttribute('href') . \"\\n\";\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This class allows an element's attributes to be accessed as if they were a plain old Perl hash.\nAttribute names become hash keys. Namespaced attributes are keyed using Clark notation.\n\nmy $XLINK = 'http://www.w3.org/1999/xlink';\ntie my %hash, 'XML::LibXML::AttributeHash', $element;\n$hash{\"{$XLINK}href\"} = 'http://localhost/';\nprint $element->getAttributeNS($XLINK, 'href') . \"\\n\";\n\nThere is rarely any need to use XML::LibXML::AttributeHash directly. In general, it is possible\nto take advantage of XML::LibXML::Element's overloading. The example in the SYNOPSIS could have\nbeen written:\n\n$element->{'href'} = 'http://example.com/';\nprint $element->getAttribute('href') . \"\\n\";\n\nThe tie interface allows the passing of additional arguments to XML::LibXML::AttributeHash:\n\ntie my %hash, 'XML::LibXML::AttributeHash', $element, %args;\n\nCurrently only one argument is supported, the boolean \"weaken\" which (if true) indicates that\nthe tied object's reference to the element should be a weak reference. This is used by\nXML::LibXML::Element's overloading. The \"weaken\" argument is ignored if you don't have a working\nScalar::Util::weaken.\n",
            "subsections": []
        }
    },
    "summary": "XML::LibXML::AttributeHash - tie an XML::LibXML::Element to a hash to access its attributes",
    "flags": [],
    "examples": [],
    "see_also": []
}