GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  XML::LIBXML::ATTRIBUTEHASH (3)

.ds Aq ’

NAME

XML::LibXML::AttributeHash - tie an XML::LibXML::Element to a hash to access its attributes

CONTENTS

SYNOPSIS



 tie my %hash, XML::LibXML::AttributeHash, $element;
 $hash{href} = http://example.com/;
 print $element->getAttribute(href) . "\n";



DESCRIPTION

This class allows an element’s 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.



 my $XLINK = http://www.w3.org/1999/xlink;
 tie my %hash, XML::LibXML::AttributeHash, $element;
 $hash{"{$XLINK}href"} = http://localhost/;
 print $element->getAttributeNS($XLINK, href) . "\n";



There is rarely any need to use XML::LibXML::AttributeHash directly. In general, it is possible to take advantage of XML::LibXML::Element’s overloading. The example in the SYNOPSIS could have been written:



 $element->{href} = http://example.com/;
 print $element->getAttribute(href) . "\n";



The tie interface allows the passing of additional arguments to XML::LibXML::AttributeHash:



 tie my %hash, XML::LibXML::AttributeHash, $element, %args;



Currently only one argument is supported, the boolean weaken which (if true) indicates that the tied object’s reference to the element should be a weak reference. This is used by XML::LibXML::Element’s overloading. The weaken argument is ignored if you don’t have a working Scalar::Util::weaken.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 XML::LIBXML::ATTRIBUTEHASH (3) 2016-02-27

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.