473,385 Members | 1,772 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Design question - HTML table parser

Rio
I'm trying to build HTML table parser (available not satisfying my needs), I
need to know what is in every cell, along with its cell, row and table
number plus the attributes that go with those tags.

I create Table, TableRow and TableCell objects each containing an array list
of subelements. That works fine when the tables are not nested, so my
question is how would I design Table that holds Rows that hold Cells which
again can contain the whole Table!
Jul 17 '05 #1
2 4344

"Rio" <ri*************@yahoo.com> wrote in message
news:co**********@ls219.htnet.hr...
I'm trying to build HTML table parser (available not satisfying my needs), I need to know what is in every cell, along with its cell, row and table
number plus the attributes that go with those tags.

I create Table, TableRow and TableCell objects each containing an array list of subelements. That works fine when the tables are not nested, so my
question is how would I design Table that holds Rows that hold Cells which again can contain the whole Table!

<table>
<tr>
<td>content</td>
<td> <table>
<tr>
<td>content</td>
<td>more content</td>
</tr>
</table>
</td>
</tr>
</table>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.799 / Virus Database: 543 - Release Date: 11/19/2004
Jul 17 '05 #2
Rio wrote:
I'm trying to build HTML table parser (available not satisfying my needs),
I need to know what is in every cell, along with its cell, row and table
number plus the attributes that go with those tags.

I create Table, TableRow and TableCell objects each containing an array
list of subelements. That works fine when the tables are not nested, so my
question is how would I design Table that holds Rows that hold Cells
which again can contain the whole Table!


I'd suggest creating an interface TableData. Then each TableCell can contain
TableData, and Table could implement that.

I used something like this in an old HTML -> fixed width formatted text
parser.

public interface TableData {
public String[] getText();
}

public class Table implements TableData {
....
}

public class TableCell {
public TableCell(TableData) {...}
}

Jul 17 '05 #3

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

Similar topics

3
by: Mitchua | last post by:
When I run the well quoted line: my $ascii = HTML::FormatText->new->format(HTML::Parse::parse_html($html)); to remove HTML tags from an html document, it replaces all tables with "". Is there a...
3
by: Himanshu Garg | last post by:
Hello, I am trying to pinpoint an apparent bug in HTML::Parser. The encoding of the text seems to change incorrectly if the locale isn't set properly. However Parser.pm in the directory...
17
by: tshad | last post by:
Many (if not most) have said that code-behind is best if working in teams - which does seem logical. How do you deal with the flow of the work? I have someone who is good at designing, but...
4
by: Nathan Sokalski | last post by:
When editing an ASP Table, Visual Studio does not allow me to edit it in Design View. This makes it harder to add elements, because I must add every element either by using Design View to create...
7
by: mathieu | last post by:
Hello there, I am looking for suggestions for designing a simple file format based on XML. It will only contain text information (no binary data). 1. If I have a choice: Element or Attribute ?...
4
by: Rick Walsh | last post by:
I have an HTML table in the following format: <table> <tr><td>Header 1</td><td>Header 2</td></tr> <tr><td>1</td><td>2</td></tr> <tr><td>3</td><td>4</td></tr> <tr><td>5</td><td>6</td></tr>...
4
by: =?ISO-8859-15?Q?Luigi_Malag=F2?= | last post by:
Hello, i'm new to function pointers. I have some code that parses some configuration files using flex and bison. I have to use the same parse for different files, but the information i parse have...
5
by: alebcn75 | last post by:
Hello, I'm trying to solve the following issue which is puzzling me. I have a concrete class, say Parser, which provides some basic parsing functionality (such as reading word by word, line by...
0
by: Lars Eighner | last post by:
In our last episode, <004f629c$0$10265$c3e8da3@news.astraweb.com>, the lovely and talented mark4asp broadcast on comp.infosystems.www.authoring.html: I have not done this, not even on...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...

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.