The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Help with an (easy) parser aristegui Shell Programming and Scripting 7 07-15-2008 06:17 AM
Text Parser karthikn7974 Shell Programming and Scripting 8 04-22-2008 05:16 AM
Perl XML:Parser help vincaStar Shell Programming and Scripting 0 03-31-2008 01:01 AM
xml parser in perl zedex Shell Programming and Scripting 1 03-29-2008 11:37 AM
string parser flextronics Shell Programming and Scripting 8 08-28-2006 04:39 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-29-2008
trek trek is offline
Registered User
  
 

Join Date: Apr 2008
Location: Austria
Posts: 9
xml-parser with perl

Hello

I want to write an xml- parser with perl an i use the libary XML::LibXML.

I have a problem with the command getElementsByTagName.
If there is an empty tag, the getElementsByTagName method returns a NodeList of length zero.

how can i check if this is a nodelist of lenght zero??

i wanted to use a if loop if($var eq "")
but then i get the error:
Operation "eq": no method found,
left argument in overloaded package XML::LibXML::NodeList,
right argument has no overloaded magic at ./conv line 284.


does anyone knows a solution to my problem?

thx
  #2 (permalink)  
Old 08-29-2008
spirtle spirtle is offline
Registered User
  
 

Join Date: Jun 2008
Location: Scotland
Posts: 150
getElementsByTagName gives you a list, right?. You can find the length of a list in perl by evaluating it in scalar context
Code:
scalar( @list );
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:27 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0