JEditorPane slow HTML parsing and GUI lockup
Hi,
I use a JEditorPane to display HTML page. If the page is relatively small, everything is ok, but with big pages (about 1 Mb) it takes a huge amount of time to load (actually, to parse) the page. And the main problem is that user interface locks and doesn't even repaint unitl page is loaded. Is there any workaround to this problem? I use JDK 1.5.0_2 std. edition.
Try loading a 1Mb plain text file and you will find
that loading is slow. So it will only be slower with
the additional parsing required for an HTML file.Really? The following is the text loading code, which is run in a separate thread:
BufferedInputStream in = new BufferedInputStream(con.getInputStream());
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String line;
if(type.startsWith("text/plain")||type.startsWith("text/xml")) // It's not an HTML page
jEditorPane1.setContentType("text/plain");
jEditorPane1.setFont(new Font("Monospaced",Font.PLAIN,14));
page=new StringBuilder();
Document ed_doc=jEditorPane1.getDocument();
while ( ( line = reader.readLine()) != null )
line=line.concat("\n");
page.append(line);
ed_doc.insertString(ed_doc.getLength(),line,null);
jEditorPane1.getDocument().putProperty(HTMLDocument.StreamDescriptionProperty, u);Yes, it takes some time to load a big page, but no, it does not block GUI repainting and does not block any events such as mouse, etc.
I'm not an HTML
expert but I believe if you have, for example, a
large table structure then the table won't be painted
until the parser knows how many columns is in the
table and how wide to make each column. It can't
determine column width until all the data is read.The files I use for testing don't have tables, etc. See this: http://www.lib.ru/ADAMS/liff.txt (Though it ends with .txt, it is html file - almost plain text with some HTML formatting tags). So, again, the problem is not that parsing is slow; the problem is that parsing blocks any gui events, and I'd like to know why and how to cope this problem. Running setPage() in separate thread doesn't change anything.
Similar Messages
-
Problem with HTML Parser and multiple instances
I have a parser program which queries a online shopping comparison web page and extracts the information needed. I am trying to run this program with different search terms which are created by entering a sentence, so each one is sent separately, however the outputs (text files) are the same for each word, despite the correct term and output file seeming passed. I suspect it might be that the connection is not being closed each time but am not sure why this is happening.
If i create an identical copy of the program and run that after the first one it works but this is not an appropriate solution.
Any help would be much appreciated. Here is some of my code, if more is required i will post.
To run the program:
StringTokenizer t = new StringTokenizer("red green yellow", " ");
int c = 0;
Parser1 p = new Parser1();
while (t.hasMoreTokens()) {
c++;
String tok = t.nextToken();
File tem = new File("C:/"+c+".txt");
p.mainprog(tok, tem);
p.mainprog(tok, tem)
p.mainprog(tok, tem);
}The parser:
import javax.swing.text.html.parser.*;
import javax.swing.text.html.*;
import javax.swing.text.*;
import java.awt.*;
import java.util.*;
import javax.swing.*;
import java.io.*;
import java.net.*;
public class Parser1 extends HTMLEditorKit.ParserCallback {
variable declarations
public void handleStartTag(HTML.Tag t, MutableAttributeSet a, int pos){
...methods
public void handleText(char[] data, int pos){
...methods
public void handleTitleTag(HTML.Tag t, char[] data){
public void handleEmptyTag(HTML.Tag t, char[] data){
public void handleSimpleTag(HTML.Tag t, MutableAttributeSet a, int pos){
...methods
static void mainprog(String term, File file) {
...proxy and authentication methods
Authenticator.setDefault(new MyAuthenticator() );
HTMLEditorKit editorKit = new HTMLEditorKit();
HTMLDocument HTMLDoc;
Reader HTMLReader;
try {
String temp = new String(term);
String fullurl = new String(MainUrl+temp);
url = new URL(fullurl);
InputStream myInStream;
myInStream = url.openConnection().getInputStream();
HTMLReader = (new InputStreamReader(myInStream));
HTMLDoc = (HTMLDocument) editorKit.createDefaultDocument();
HTMLDoc.putProperty("IgnoreCharsetDirective", new Boolean(true));
ParserDelegator parser = new ParserDelegator();
HTMLEditorKit.ParserCallback callback = new Parser1();
parser.parse(HTMLReader, callback, true);
callback.flush();
HTMLReader.close();
myInStream.close();
catch (IOException IOE) {
IOE.printStackTrace();
catch (Exception e) {
e.printStackTrace();
try {
FileWriter writer = new FileWriter(file);
BufferedWriter bw = new BufferedWriter(writer);
for (int i = 0; i < vect.size(); i++){
bw.write((String)vect.elementAt(i));
if (vect.elementAt(i)!=vect.lastElement()){
bw.newLine();
bw.flush();
bw.close();
writer.close();
catch (IOException IOE) {
IOE.printStackTrace();
catch (Exception e) {
e.printStackTrace();
} catch (IOException IOE) {
System.out.println("User options not found.");
}How many Directory Servers are you using?
Are both serverconfig.xml files of PS instances the same?
Set debug level to message in the appropriate AMConfig.properties of your portal instances and look into AM debug files.
For some reason amSDK seems not to get the correct service values.
-Bernhard -
Slow response time and frequent lockups?
Why does my Adobe Premiere Elements 9 and Adobe Photoshop Elements 8 constantly lock up (not responding on Task Manager) and/or the response time to do anything is unacceptable (1 minute oe more to do a rename). I don't think my lap top is the issue is brand new with 6GB of RAM. I'm to Adobe Elements and Photoshop and so far I disappointed. Any ideas? Thanks!
It could be any number of things -- but you haven't given us enough information to be able to help you.
Are you running the 64-bit version of Windows 7? You may want to check out the 64-bit version of Windows 10. It runs like the wind on that OS!
New computers are usually full of outdated drivers, temp files and fragmentation.
Have you manually gone to Windows Update and downloaded all of the latest updates? Do you have the latest version of Quicktime, per the program's requirements?
When did you last clean and defragment your system? In my books, I recommend Advanced System Care from iobit. It cleans your temp files, tunes your registry and defragments with a single button. And it's free!
http://www.iobit.com/advancedsystemcareper.html
When does it lock up? When you first starting the program or when you're in the midst of editing? What is the source of the video you're editing when it locks? -
How to parse a HTML file using HTML parser in J2SE?
I want to parse an HTML file using HTML parser. Can any body help me by providing a sample code to parse the HTML file?
Thanks nad Cheers,
AmareshWhat HTML parser and what does "parsing" mean to you?
-
APPLESCRIPT AND HTML PARSING.
hi,
im new to applescript so im not quite sure if what i want to do is actually called html parsing.. but basically i want to put a variable in applescript that is linked to the actual html but i dont know how to make applescript access data inside a html code... to give u a better idea, inside the html is something like this:
100
now that value "100" changes but its maximum amount is 100. i want to create a script which responds to change when that value starts to drop by loading another link.
am i making sense? again the thing id like to achieve is make applescript use that value INSIDE the HTML as its own variable (and perform the right actions as that value changes)
any help would be appreciated.In first place you could open the site you talked about in safari and run a little javascript via applescript to get that value.
Javascript is the "best" way to get a special value out of an HTML-Element, but only works in browsers.
e.g.
tell application "Safari"
open location "http://apple.com"
delay 6
set mypromo to do JavaScript "document.getElementById('promos').getElementsByTagName('a')[0].title" in document 1
display dialog "Title of first Promo is:" & return & mypromo
end tell
Or you could just d/l the pure source convert it to text and search for the phrase you are looking for
e.g.
set mysource_html to do shell script "curl http://mysite.org/bla.html"
set mysource_txt to do shell script "curl http://mysite.org/bla.html | textutil -stdin -convert txt -format html -stdout"
if mysource_html contains "<a>100</a>" then
display dialog "Hey, value of 100 is reached"
end if
--or something like
if mysource_txt contains "100" then
display dialog "Hey, value of 100 is reached"
end if -
How to parser a html page and get useful information?
now ,I try to get the page by the url,after getting the whole page,
is there any way to get the useful text ,and abandon other ,liks ,ad likes,
other related links?
I try to use java.util.regex.*;
is there any other methods for dointg this?Regex isn't a good method unless your requirements are quite simple. In general if you want a Java HTML parser they are not hard to find -- "java html parser" is a good choice of keywords for an internet search.
-
Sleep() in ActionScript3 and/or Html parser issue
Hello, I hope you can help me, please.
I am using a html parser (http://code.google.com/p/htmlsprite/) to render several tables into a movieclip.
My problem is: as it takes some time to render, the only one actually being added to the movieclip is the last one. I would use a timer, but that means I would need to call a function, and I am using a "for" loop to build the movielips. Is there a way to say "wait for x seconds before continuing processing" in ActionScript3?
Thank you very much for your help.You can't stall a for loop from procesing. Instead of using a for loop, you could use a Timer to control the speed at which some code executes.
-
Problems with parsing and display a XML-File
Hi,
I'm working on an applet to read a XML-file, display the content in a JTree, in order to modify and save it again. I found this tutorial: http://java.sun.com/webservices/jaxp/dist/1.1/docs/tutorial/dom/index.html
I took this example http://java.sun.com/webservices/jaxp/dist/1.1/docs/tutorial/dom/work/DomEcho02.java and modified it, to run it as an applet.
I changed the method main into:
public class EditorTest extends JApplet {
public void init(){
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder builder = factory.newDocumentBuilder();
File file = new File("/path/inhalt.xml");
document = builder.parse(file);
} catch (SAXException sxe) {
// Error generated during parsing)
Exception x = sxe;
if (sxe.getException() != null)
x = sxe.getException();
x.printStackTrace();
catch (ParserConfigurationException pce) {
// Parser with specified options can't be built
pce.printStackTrace();
} catch (IOException ioe) {
// I/O error
ioe.printStackTrace();
makeWindow(); //equals makeFrame(); in the tutorial
} //initThe method makeWindow() looks like this:
private Container container;
private void makeWindow(){
container = getContentPane();
JDesktopPane desktop = new JDesktopPane();
final EditorTest echoPanel = new EditorTest();
JMenuBar menuBar = MakeMenuBar(); //returns a JMenuBar with a few items in it
container.add(menuBar, BorderLayout.NORTH);
}The constructor:
public DomEcho02() {
// Set up the tree
JTree tree = new JTree(new DomToTreeModelAdapter());
// Build left-side view
JScrollPane treeView = new JScrollPane(tree);
treeView.setPreferredSize( new Dimension( leftWidth, windowHeight ));
// Build right-side view
final JEditorPane htmlPane = new JEditorPane("text/html","");
htmlPane.setEditable(true);
JScrollPane htmlView = new JScrollPane(htmlPane);
htmlView.setPreferredSize(new Dimension( rightWidth, windowHeight ));
// Build split-pane view
JSplitPane splitPane = new JSplitPane( JSplitPane.HORIZONTAL_SPLIT, treeView, htmlView );
splitPane.setContinuousLayout( true );
splitPane.setDividerLocation( leftWidth );
splitPane.setPreferredSize( new Dimension( windowWidth + 10, windowHeight+10 ));
// Add GUI components
this.setLayout(new BorderLayout());
this.add("Center", splitPane );
} // ConstructorI didn't change the class AdapterNode and DomToTreeModelAdapter. When I change the line "JTree tree = new JTree(new DomToTreeModelAdapter());" into "JTree tree = new JTree();", the applet starts and display a standard-JTree, as it ist generated by the constructor. If I want to display my own Tree the applet fails. When I start it with the appletviewer I get this message:
java.lang.NullPointerException
at DomEcho02$AdapterNode.childCount(DomEcho02.java:151)
at DomEcho02$DomToTreeModelAdapter.isLeaf(DomEcho02.java:167)
at javax.swing.JTree.setModel(JTree.java:704)
at javax.swing.JTree.<init>(JTree.java:511)
at DomEcho02.<init>(DomEcho02.java:51)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at java.lang.Class.newInstance0(Class.java:350)
at java.lang.Class.newInstance(Class.java:303)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:721)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:650)
at sun.applet.AppletPanel.run(AppletPanel.java:324)
at java.lang.Thread.run(Thread.java:595)
Is there anyone out there, who knows how to fix it?
Thanks in advance.I found out, how it was going wrong.
When the applet started, it didn't start with the method init(), as it should do, it started with the constructor. Because there was no document the method childCount() throws a exception. After this, the method init() startet reading the file and started the constructor again, but the results were not shown.
After knowing this I decided to write the Applet again and now it's working fine. -
XML Parser and Content-type/encoding problem
I've write a little and simple XML parser and a simple "trasformer" that recive an XML file and an XSL one and return HTML, here is the code:
public static String toHTML(Document doc, String xslSource){
ByteArrayOutputStream testo = new ByteArrayOutputStream();
try{
DOMSource source = new DOMSource(doc);
TransformerFactory tFactory = TransformerFactory.newInstance();
System.out.println("----> " + xslSource);
Transformer transformer = tFactory.newTransformer(new StreamSource(xslSource));
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
transformer.setOutputProperty(OutputKeys.METHOD, "html");
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
transformer.transform(source, new StreamResult(testo));
}catch(Exception ioe){
System.out.println("2 XMLTool.toHTML " + new java.util.Date());
System.out.println(ioe);
return testo.toString();
}the problem is that I would like to put the HTML code its return into a JEditorPane; now I'm trying with this code:
JEditorPane jep1 = new JEditorPane();
jep1.setContentType("text/html");
jep1.setText(v);
// 'v' is the string returned by the code posted up (the XML/XSL transformer)but I can't see anything in my JEditorPane.
I think that the problem is this line of code that the transformer add automaticaly ad HTML code:
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">Infact if I try to delete this line from the code I can see what I want but is'n good delete a line of code without understend where is the problem.
So, can anyone help me?good.
when u set ur output properties to html , transformer
searches for all entity references and converts accordingly.
if u r using xalan these files will be used for conversion of
Character entity references for markup-significant
output_html.properties
(this should be in templates package)
and HTMLEntities.res(should be in serialize package)
vasanth-ct -
Read Text from HTML-Pages and want to solve "ChangedCharSetException"
Hello,
I have an app that connect via threads with pages and parse them an gives me only the Text-version of a HTML-page. Works fine, but if it found a page, where the text is within images, than the whole app stopps and gave me the message:
javax.swing.text.ChangedCharSetException
at javax.swing.text.html.parser.DocumentParser.handleEmptyTag(DocumentParser.java:169)
at javax.swing.text.html.parser.Parser.startTag(Parser.java:372)
at javax.swing.text.html.parser.Parser.parseTag(Parser.java:1846)
at javax.swing.text.html.parser.Parser.parseContent(Parser.java:1881)
at javax.swing.text.html.parser.Parser.parse(Parser.java:2047)
at javax.swing.text.html.parser.DocumentParser.parse(DocumentParser.java:106)
at javax.swing.text.html.parser.ParserDelegator.parse(ParserDelegator.java:78)
at aufruf.main(aufruf.java:33)So I tried to catch them with "getCharSetSpec()" and "keyEqualsCharSet( )" from the class "javax.swing.text.ChangedCharSetException" and hoped that this solved the problem. But still doesen't work...
Then I looked at the web and found, that I have to add the line:
doc.putProperty("IgnoreCharsetDirective", new Boolean(true));"doc." is a new HTML Dokument, created with the HTMLEditorKit. I do not have much knowledge about that and so I hope, that someone can explain me, how I can solve that problem, within my code.
Here we go:
import javax.swing.text.*;
import java.lang.*;
import java.util.*;
import java.net.*;
import java.io.*;
import javax.swing.text.html.*;
import javax.swing.text.html.parser.*;
public class myParser extends Thread
private String name;
public void run()
try
URL viele = new URL(name); // "name" ia a variable with a lot of links
URLConnection hs = viele.openConnection();
hs.connect();
if (hs.getContentType().startsWith("text/html"))
InputStream is = hs.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
Lesen los = new Lesen();
ParserDelegator parser = new ParserDelegator();
parser.parse(br,los, false);
catch (MalformedURLException e)
System.err.print("Doesn't work");
catch (ChangedCharSetException e)
e.getCharSetSpec();
e.keyEqualsCharSet();
e.printStackTrace();
catch (Exception o)
public void vowi(String n)
name = n;
}and for the case that it is important here is the class "Lesen"
import java.net.*;
import java.io.*;
import javax.swing.text.*;
import javax.swing.text.html.*;
import javax.swing.text.html.parser.*;
class Lesen extends HTMLEditorKit.ParserCallback
public void handleStartTag(HTML.Tag t, MutableAttributeSet a, int pos)
try
if ((t==HTML.Tag.P) || (t==HTML.Tag.H1) || (t==HTML.Tag.H2) || (t==HTML.Tag.H3) || (t==HTML.Tag.H4) || (t==HTML.Tag.H5) || (t==HTML.Tag.H6))
System.out.println();
catch (Exception q)
System.out.println(q.getMessage());
public void handleSimpleTag(HTML.Tag t,MutableAttributeSet a, int pos)
try
if (t==HTML.Tag.BR)
System.out.println(); // Neue Zeile
System.out.println();
catch (Exception qw)
System.out.println(qw.getMessage());
public void handleText(char[] data, int pos)
try
System.out.print(data); // prints the text from HTML-pages
catch (Exception ab)
System.out.println(ab.getMessage());
}Thanks a lot for helping...
Stephanparser.parse(br,los, false);
parser.parse(br,los, true); -
I am trying to parse the HTML, and for a HTML code like this
<span class="authorName">Steve </span>
I want to retrieve the value "Steve"
Right now, I am using a parser, to generate the HTML tree and by using the this code..
Tidy tidy = new Tidy();
tidy.setXHTML(xhtml);
d = tidy.parseDOM(in,out);
NodeList spanNode = d.getElementsByTagName("span");
int length = spanNode.getLength();
for(int i = 0;i<length;i++)
org.w3c.dom.Node span = spanNode.item(i);
String tempAltText = span.getAttributes().getNamedItem("class").getNode Value();
if(tempAltText.equals("authorName")){
System.out.println("the item is " + tempAltText);
else{
}The tempAltText is storing "authorName" as a string but not "Steve"
please give me some suggestions......try this
XPathFactory factory=XPathFactory.newInstance();
XPath xPath=factory.newXPath();
XPathExpression xPathExpression=xPath.compile("//*[@class='authorName']");
System.out.println(xPathExpression.evaluate(d)); -
HTML Parsers and reading all files in a directory
Hello all,
I was wondering if there was a html parser included in java. I am writing a program where I want to be able to search all the files in a directory tree for a particular string. I was able to read one file in a single directory but not in any other directory. How would I go about writing code to be able to access all files in directory that has multiple sub folders.
Also, when I started to write my program I tried to use the DOM XML Parser to parse my html page. My logic behind this decision was that if you look at html code it is an xml document. But as I was trying to run my program I noticed that I had to convert my html document into xml format. I really don't want to have to build my own html parser. Is there a html parser that is included in Java. Oh my program is just your basic text program. No interfaces.
Thanks for any help that you can provide
Hockeyfana particular string. I was able to read one file in
a single directory but not in any other directory.
How would I go about writing code to be able to
access all files in directory that has multiple sub
folders.
You can do that several ways.
Most likely you'll end up with some sort of recursive iteration over the directory tree.
Not hard to write, somewhat harder to prevent memory problems if you end up with a lot of data.
Also, when I started to write my program I tried to
use the DOM XML Parser to parse my html page. My
logic behind this decision was that if you look at
html code it is an xml document. But as I was
trying to run my program I noticed that I had to
convert my html document into xml format. I really
don't want to have to build my own html parser. Is
there a html parser that is included in Java. Oh my
program is just your basic text program. No
interfaces.
A VALID xhtml document is a valid XML document.
Problem is that most HTML isn't xhtml.
Another problem is that most HTML is fundamentally broken even to its own standards (which have always been based on SGML on which XML is also based).
Browsers take that into account by being extremely lax on standards compliance and effectively making up tags as they go along to fill in the missing ones in the trees they parse.
That's however not a standardised process and each browser handles it differently (and as a result most html will render differently in different browsers).
Java contains a simple HTML parser in Swing, but it's primitive and will only parse a subset of HTML 2.0.
There are almost certainly 3rd party libraries out there that can do better, both free and/or commercial. -
STYLE tag problem in HTML Parser.
Hi,
I am trying to parse a HTML file. I am able to extract context of various tags like Tag.SPAN,Tag.DIV and so...
I want to extract the text content of Tag.Style. What to do? The problem is that HTML Parser right now doesnot support this tag along with 5 more tags which are Tag.META,Tag.PARAM and so..
Please help me out.Before responding to this posting, you may want to check out the discussion in the OP's previous posting on this topic:
http://forum.java.sun.com/thread.jspa?threadID=634938 -
Basic HTML concepts and how they relate to eachother
I am a grad student working on a project to visualize how the HTML markup is translated into a webpage in a browser. I am not a programmer, and thus am confused by how all the following concepts relate to one another. The goal lis to list them in a logical order and describe how one concept leads to the next in a sequential manner.
I’d like to create a hierarchal list of all these terms and their definitions as a start. Here’s what I have so far.
Tried to start with the most basic, and work my way up Any help would be appreciated. Any errors?
SPECIFICATIONS
WC3 / WHTWG Specification
Defines the semantics, structure, syntax, and rendering of HTML code
elements in HTML5 (tags)
any element in the HTML namespace (as per the doctype declaration) - refers to all tags and their attributes - these tags are used to describe the meaning of the content they contain
content model types (tags can fit in one ore more of these categories of model types)
metadata - content that sets up the presentation or behavior of the rest of the content
flow - elements that would be included in the normal flow of the document (fits in the HTML body tag)
sectioning - defines the scope of heading and footers - create new sections in document
heading - defines the header of a section, which can either be explicitly marked up with sectioning elements or implied by the heading content itself
phrasing (similar to inline in HTML 4) - the text of the document, as well as elements used to mark up the text within paragraph level structures
embedded - any content that imports other resources into the document
interactive - any content that is specifically interacted for user interaction
Outline Algorithm (definition)
Definition in the HTML5 spec of the rules that user agents should use when parsing code in order creating an outline of section content elements in an HTML document
he outline (based on their ranking)
AUTHOR
HMTL5 Document - the document contenting HTML elements and authored content
Document Semantics - the meaning associated with each HTML element Tag
the collection of tags with meaning form the semantic structure of the HTML document
Document Structure (combination of ordered semantic elements) - the order and nesting of tags, and the associations associated with the levels of nesting (ranking) create the document structure
understanding the W3C outline Algorithm helps the author decide how and when to chose which elements to properly structure content
understanding the process that HTML5 uses to outline documents will help in this decision
USER AGENT (BROWSER)
User Agent (browser)-
the browser (application that user operates to interact with HTML documents
parsing algorithm (executed) - the rules the browser uses to parses (walks through) the elements in order to establish its structure and add to the outline using a parsing engine
examples: webkit (safari) and gecko (firefox)
body is established as the outline root (beginning)
the result of the parsing is a Document object Model (DOM) and the Document Ouline
Document outline - the nested, hierarchical outline created by the browser parsing the html document’s structure and content
each part of the outline is considered a node
(relationships in the node are described with family tree terms like parent, child, and sibling.)
sectioning and heading elements are used to define the outline
sectioning elements are containers - so any elements contented within a a section is nested as a child in the parent’s section
DOM -
The DOM is the structure created by the DOM API in which CSS and Javascript interact with and modify the HTML
based on an object structure that closely resembles the structure of the documents it models.
structure similar to that of a tree - in which every element is a node
similar to the document outline, but instead of a hierarchical list, the DOM is a tree diagram
OUTPUT
Final webpageAs a rule of thumb, avoid all swing components (just use awt) because they are only available in 1.2. You can use all enhancements and bug fixes to awt components that are available in 1.4 (even 1.5).
;o)
V.V. -
Don't understand error message from HTML parser?
I've written a simple test program to parse a simple html file.
Everything works fine accept for the <img src="test.gif"> tag.
It understands the img tag and the handleSimpleTag gets called.
I can even pick out the src attribute. But I get a very strange error message.
When I run the test program below on the test.html file (also below) I get the following output:
handleError(134) = req.att srcimg?
What does "req.att srcimg?" mean?!?!?
/John
This is my test program:
import javax.swing.text.html.*;
import javax.swing.text.*;
import javax.swing.text.html.parser.*;
import java.io.*;
public class htmltest extends HTMLEditorKit.ParserCallback
public htmltest()
super();
public void handleError(String errorMsg, int pos)
System.err.println("handleError("+pos+") = " + errorMsg);
static public void main (String[] argv) throws Exception
Reader reader = new FileReader("test.html");
new ParserDelegator().parse(reader, new htmltest(), false);
This is the "test.html" file
<html>
<head>
</head>
<body>
This is a plain text.<br>
This is <b>bold</b> and this is <i>itallic</i>!<br>
<img src="test.gif">
"This >is also a plain test text."<br>
</body>
</html>
----------------------------------------------------------------------The handleError() method is not well documented any more than whole javax.swing.text.html package and its design structure. You can ignore the behavior of the method if other result of the parser and your HTML file are proper.
Maybe you are looking for
-
Looking for help on importing video in Lightroom 4.4
I am not sure when this started happening or what has changed. I went to import some video and in the import dialog box all my video files show "Preview unavailable for this file" in the thumbnail in the grid view. And if I try to import them i get
-
Hi I am facing a problem with SAP B1 when i try to add a new purchase order or GRPO it is throwing an error " Failed to commit transaction" why this is happening. make me to solve it soon thaku mahi
-
Conditions on Query not executing
I have a report where in I have a condition on a Key Figure, I had to place this in the rows section, But the condition is not being executed.
-
hi have anyone an idea how can i make screenshoot from my scene without the class robot? at moment i use the Robot class to make screenshoots from my sceene Rectangle screenRect = new Rectangle(20,10,800,600); try{ Robot robot
-
The smart blur filter is not working, I need to know wh y it is happening?