Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

xml::libxml::attributehash(3) [centos man page]

XML::LibXML::AttributeHash(3)				User Contributed Perl Documentation			     XML::LibXML::AttributeHash(3)

NAME
XML::LibXML::AttributeHash - tie an XML::LibXML::Element to a hash to access its attributes SYNOPSIS
tie my %hash, 'XML::LibXML::AttributeHash', $element; $hash{'href'} = 'http://example.com/'; print $element->getAttribute('href') . " "; 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') . " "; 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') . " "; 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. perl v5.16.3 2013-05-13 XML::LibXML::AttributeHash(3)

Check Out this Related Man Page

XML::LibXML::NodeList::Iterator(3pm)			User Contributed Perl Documentation		      XML::LibXML::NodeList::Iterator(3pm)

NAME
XML::LibXML::NodeList::Iterator - Iteration Class for XML::LibXML XPath results SYNOPSIS
use XML::LibXML; use XML::LibXML::NodeList::Iterator; my $doc = XML::LibXML->new->parse_string( $somedata ); my $nodelist = $doc->findnodes( $somexpathquery ); my $iter= XML::LibXML::NodeList::Iterator->new( $nodelist ); # more control on the flow while ( $iter->nextNode ) { # do something } # operate on the entire tree $iter->iterate( &operate ); DESCRIPTION
XML::LibXML::NodeList::Iterator is very similar to XML::LibXML::Iterator, but it does not iterate on the tree structure but on a XML::LibXML::NodeList object. Because XML::LibXML::NodeList is basicly an array the functionality of XML::LibXML::NodeList::Iterator is more restircted to stepwise foreward and backward than XML::LibXML::Iterator is. SEE ALSO
XML::LibXML::NodeList, XML::NodeFilter, XML::LibXML::Iterator AUTHOR
Christian Glahn, <phish@cpan.org> COPYRIGHT
(c) 2002-2007, Christian Glahn. All rights reserved. This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.0 2007-09-28 XML::LibXML::NodeList::Iterator(3pm)
Man Page

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Handling of the various XML syntax scenario

Hi hackers, I would like to parse the value of one XML tag (e.g. <TAG>). Following is the script that I have written. awk -F"" '/<TAG>/,/<\/TAG>/ { if ( NF == 1 ) { sub(/^*/,"", $1) print $1 } } Above ascipt works fine for the following XML tag syntax. i.e. prints "Hi" ... (8 Replies)
Discussion started by: viki
8 Replies

2. Shell Programming and Scripting

Finding a XML element and moving the file

Hi All, I am looking for a awk/shell which can find an element named REFERENCE in a XML file and check whether it is empty or not. If there is no value in the REFERENCE element then correspondingly move the file to some other folder. The Unix server is AIX version 4. Any inputs... (9 Replies)
Discussion started by: karansachdeva
9 Replies

3. Shell Programming and Scripting

Perl question - print last element in a hash?

I am modifying someone else's code. There is a foreach statement printing the contents of a hash. Can someone give me an example of printing the last element in a hash? The output currently is A B C D E I want the output to be E (1 Reply)
Discussion started by: streetfighter2
1 Replies

4. Shell Programming and Scripting

Extracting the Root Element from the XML File

Any help to extract the root element from an XML file will be appreciated. Example: test.xml <?xml version="1.0" encoding="utf-8" ?> <TestXMLMessage> <TestRec> <ID>1000</ID> </TestRec> </TestXMLMessage> Wanted to extract the TestXMLMessage. Regards, Chari (6 Replies)
Discussion started by: sree_chari
6 Replies

5. Programming

Perl script to create latex template.

Hi, I have XML file and I extracted some tags and stored in hash, my data as look like this $var1={ 'stud.xml'={ '24'=>'<address> <streetname="xxxx"/> <housenum="138"/"> ... (9 Replies)
Discussion started by: veerubiji
9 Replies

6. Shell Programming and Scripting

Find if XML element has a matching required element

I want to check if every <Part> element has corresponding <Description> in this sample XML. ....<Lot Of XML> <Inv lineNumber="2"> <Item> ... (4 Replies)
Discussion started by: kchinnam
4 Replies

7. Shell Programming and Scripting

Help with Permission Denied on script with sed

I am trying to develop a script to replace a lowercase URLs with an upper case URLs in HTM files. Basically.. replace href="somelowercaseurl" with href="SOMEUPPERCASEURL". In place. the href's are not located in any specific position in the file. Here is my shell script : export... (5 Replies)
Discussion started by: smarty
5 Replies

8. Shell Programming and Scripting

Confusion in hash

Hi folks, If a declare a direct hash , then the hash element works fine. my %test = ("test",1); print %test; print "\n"; Here in the above, the name of the hash is predeclared... Suppose now I need to create the hash elements dynamically in the for loop. $test="hash"; my... (1 Reply)
Discussion started by: scriptscript
1 Replies

9. Shell Programming and Scripting

Perl giving unexpected md5 hash values

I am trying to speed up creating a line by line hash file from a huge file using Perl. Here is my current (working but too slow) Bash code: (while read line; do hash=$(echo -n $line | md5sum); echo ${hash:0:32}; done)And here is my Perl code: perl -MDigest::MD5 -le 'foreach $line ( <STDIN> )... (3 Replies)
Discussion started by: Michael Stora
3 Replies

10. UNIX for Beginners Questions & Answers

How can we extract specific elements from XML?

Hi, I have a requirement to extract specific element value dynamically from XML message. Here is the sample message: <File> <List> <main> <dir>doc/store834/archive</dir> <count>5</count> </main> <main> <dir>doc/store834/extract</dir> <count>6</count> </main> <main> ... (3 Replies)
Discussion started by: renukeswar
3 Replies