[jdom-interest] HTMBuilder
Laurent ROMEO
romeo at agisphere.com
Mon Mar 19 14:53:22 PST 2001
Hi,
I've asked a few days ago about a problem due to DOM Level incompatibility
in the DOMBuilder class after having found a DOM document with JTidy.
I noticed the writting of an HTMBuilder was in the TODO notes.
I began the work, and here is the source file. I used the SAXBuilder class
as a template, and my dirty tricks are in it.
In fact, it's not so pretty. It's only a wrapper towards JTidy, and my
previous post and its patch is really needed...
To use it, you can write for example :
// ---------------------
File sourceFile = new File( "foo.html" );
Document htmlDocument = null;
try {
htmlDocument = htmlBuilder.build( sourceFile );
} catch ( JDOMException e ) {
System.out.println( "Problem while parsing HTML file" );
}
//---------------------
I know that we should rewrite JTidy for directly generating a JDOM tree,
but it is far more complicated than what I did :-)
I hope this little code will help a few people while waiting for a better
implementation.
Laurent ROMEO
AGISphere
romeo at agisphere.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HTMLBuilder.java
Type: application/octet-stream
Size: 5043 bytes
Desc: not available
Url : http://jdom.org/pipermail/jdom-interest/attachments/20010319/15b753fb/HTMLBuilder.obj
More information about the jdom-interest
mailing list