I need a HTML parser that can provide element width information
(Similar to when the HTML page is displayed in the browser, the width
of an element is needed, in Dreamweaver, you can check the width info
of an element). I need to access the width information in the Java
program, so the parser needs to be written in Java, or has an
interface that can be accessed from Java. Some examples of the element
referred here are <table> <tr> <td> <img>. Your help is really
appreciated. |
Clarification of Question by
youmay-ga
on
04 Jan 2006 08:33 PST
Karthik, thank you very much for your comments. Could you provide me
more details about your approach.
|
Request for Question Clarification by
bookface-ga
on
07 Jan 2006 16:39 PST
Please clarify what you wish to do with the HTML that you read in your
Java program.
Do you JUST want to have a List of various elements on the page and
their widths? Do you also want to display these pages when the width
information has been extracted? Do you want to display the pages, and
also to be able to adjust the widths dynamically and have the HTML
updated in your display?
I am confident I can help you once I understand what your project entails.
- bookface-ga
|
Clarification of Question by
youmay-ga
on
09 Jan 2006 23:00 PST
Thank you, bookface.
What I need for my project is a Java HTML parser, the parser parses
HTML file and generates the structure build in the page (like a tree,
and tree nodes represent HTML elements such as <table> <tr> <td>
<img>). The parser also needs to parse the attributes of the HTML
element, and width is one requirement. Since width information is not
always available in the HTML source, how can I get it and assign it to
the element tree node?
If you need more information, feel free to ask. Hope to get back from you soon.
|
Request for Question Clarification by
bookface-ga
on
10 Jan 2006 19:59 PST
"The parser also needs to parse the attributes of the HTML
element, and width is one requirement. Since width information is not
always available in the HTML source, how can I get it and assign it to
the element tree node?"
When width information is not available in the HTML source, it is
derived by the HTML renderer (such as a web browser). Different
viewers will see different widths and heights for the same content,
depending on how they view it.
img heights will be at 100% as per the image resolution, but tables
and cells will not be the same size on all platforms -- nor should
they be. A web page viewed on a handheld browser should look different
than when viewed on a high resolution monitor, and part of the
flexability of HTML is that these can be left unspecified and rendered
as appropriately as possible by the user's software.
Please let me know how this affects your project.
- bookface-ga
|
Clarification of Question by
youmay-ga
on
10 Jan 2006 20:44 PST
The width information is required to infer the characteristics of the
HTML page, and according to different characteristics, I will do some
re-arrangement of the HTML page structure. So, the width information
in default HTML viewer (such as Web Browser on Desktop) will serve the
purpose.
I am not sure whether you used Dreamweaver before, the width
information for the HTML element can be get there. I need the similar
width information, but programmatically.
Thanks, bookface.
|