473,654 Members | 3,239 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with arrays or possibly HTML::Element

Hello All,

I'm trying to parse through a webpage, and I used HTML::treebuild er to
try to get it into an easily managable data structure. I am having a
bit of trouble parsing through it though.

Here is a snippet of code:

$tree = HTML::TreeBuild er->new;
$tree->parse($respons e->content);
$tree->eof();
my @tables = $tree->look_down("_ta g", "table");
my $root = $tables[0]; # Move to first table
@tables = $root->look_down("_ta g","tr");
$root = $tables[2]; # Move to third row
The problem is, at the end of this snippet if I dump the contents of
$root I get the FIRST row of the table, rather than the third.
Somehow it always assigns the first element of the table instead of
the one I specify in the brackets.

If anyone has an idea about what I'm doing wrong I would really
appreciate it. I was asked to write this script for a professor's
research and I am late on delivering it!
Jul 19 '05 #1
0 1388

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
4595
by: Björn | last post by:
Hello, Starting to code a robust routine to add two arrays element by element $new = $a + $b ... I thought that this should already be done and searched CPAN for a sutiable module. Despite Math:::Matrix I could not realy find much and the ::Matrix module seemed to be more that I needed...
3
11825
by: jonjon | last post by:
Hi, Is there any way of adding a property to an HTML element ? I heard about the "prototype" method but it doesn't work for HTML elements such as Images, or Paragraphs... Netscape implements HTMLElement objects but it seems to me that no equivalent exists in Internet Explorer ?? (I hate that browser :) Any idea ? Thank you, John.
2
11287
by: Gary | last post by:
Hi, I am developing desktop application. In the desktop application am loading a html page, i want to acces html element value from C# code. Can anyone help me? how to access a html element or clientside javascript object from C# code. Note: i am not using web server. TIA,
3
12714
by: Halo | last post by:
I have a HTML text box (NOT a TextBox server control) in a .aspx page and a button server control. Is it possible with ASP.NET to get the value of the HTML text box when I click the button? How can I get the value of an HTML element from C# on the server? Thanks!
3
1347
by: Jim Heavey | last post by:
If I have an HTML element, say a <p> tag with and ID="Fred", how do I find that element? I want to set the Style attribute to "hidden", how do I do that? Thanks!!!
2
1332
by: petermichaux | last post by:
Hi, I'm trying to remove an html element in the example below. I don't see the "bye" message at the end and there are no errors reported in Firefox or exceptions caught if I wrap the remove child line in a try-catch. Any ideas what is wrong? Thanks, Peter
1
1162
by: oranmeir | last post by:
What i want actually is that when i right click on an element in my HTML file, select "properties" and then build the style of that html element, i want that the details about the position, colors and all other parameters of the style will be held on the corelated CSS file and that VS will define a class name automaticly. what i am doing now is to copy the style properties from the HTML tag to the CSS file manually. Thanks.
0
1444
by: matthewr | last post by:
Hi, I can append children to an HTML element in a WebBrowser control (.NET 2.0) using the appendChild method. However, how can I remove a child element? Thanks, Matthew
1
1469
by: dave | last post by:
I encounted this at work today and wondering if anyone here has insight. We do this JS: <script type="text/javascript"> url = "www.servername.com" <script> the html element is:
7
2466
by: Zhang Weiwu | last post by:
Dear all How does javascript realiablily tell if a variable is a reference to an HTML Element "<select>", without causing browser to pop up error message? if (variable.constructor == HTMLElementSelect) // doesn't work, Firefox complain no such property if variable is undefined if (typeof variable == "object" && variable.constructor == HTMLElementSelect) // doesn't work, IE complain object do not have this property "constructor"
0
8379
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8294
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8816
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8596
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4297
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2719
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1924
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1597
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.