Google Answers Logo
View Question
 
Q: Java HTML parser that can provide element width information ( No Answer,   7 Comments )
Question  
Subject: Java HTML parser that can provide element width information
Category: Computers > Programming
Asked by: youmay-ga
List Price: $100.00
Posted: 03 Jan 2006 22:15 PST
Expires: 02 Feb 2006 22:15 PST
Question ID: 428815
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.
Answer  
There is no answer at this time.

Comments  
Subject: Re: Java HTML parser that can provide element width information
From: karthik_wiz-ga on 04 Jan 2006 08:11 PST
 
Hi the best way to do this is using an inbuilt browser control in
java. Once you create a new instance of the browser class, direct the
browser to lod the required html page. Then you can use normal
javascript to get the required elements width and height. You can do
this how you would do it on a normal html page. if you need more
details let me know.
Subject: Re: Java HTML parser that can provide element width information
From: mjd2006usa-ga on 11 Jan 2006 11:49 PST
 
You may consider using JavaCC HTML Parser. 
http://www.quiotix.com/downloads/html-parser/  I have not used it yet,
but have a project I'm considering it for.

- mjd
Subject: Re: Java HTML parser that can provide element width information
From: youmay-ga on 12 Jan 2006 08:18 PST
 
Thanks mjd2006usa, I used JavaCC parser before, but it can not provide
element width informaiton if it's not available in the HTML source.
Subject: Re: Java HTML parser that can provide element width information
From: exlcom-ga on 31 Jan 2006 12:03 PST
 
Hi,

 We have such a parser.  Designed to parse HTML, and provide you with
an element construction set. For $100 we'll provide you with full API
Documentation and the .jar file.  We can provide you with source code
as well.  The performance has been tested on major enterprise
applications server 1,000's of pages a minute. The API was written in
Plain Old Java Objects and can work with JSP's/Servlets.  For more
information please view the following site:

http://www.exlcom.com/exlcom/paintbrush.html

Best Regards,

Exlcom
Subject: Re: Java HTML parser that can provide element width information
From: youmay-ga on 31 Jan 2006 20:51 PST
 
Thanks, Exlcom. The solution sounds great. Since element width
information is a mandetory feature, could you confirm the parser can
provide the width info for all the elements it parsed? Thank you very
much.
Subject: Re: Java HTML parser that can provide element width information
From: exlcom-ga on 02 Feb 2006 08:18 PST
 
Yes it can provide the width information by using a generic method and
passing in the paramater name of "width".

The library has also been thoughly black box and white box tested
using Parasofts tools.
Subject: Re: Java HTML parser that can provide element width information
From: youmay-ga on 03 Feb 2006 08:37 PST
 
Great, exlcom. When can you send me the API, jar file and the source
code as well? Thanks.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy