Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

design critique
the design, so far:

Test16 implements BasicTidy
BasicTidy has a few setter methods
ControlTidy instantiates aTidy, which is a BasicTidy
Test16 imports Tidy.jar from sourceforge.net
Test16 is basically sample code from sourceforge.net
Tidy.jar converts old html to xhtml

goal #1:

a GUI with a few textfields, the setter methods in BasicTidy


goal #2:

same as #1, but instead of passing a url as parameter, pass the path to
a file on
the local hard drive.

goal #3:

pass a directory for bulk tidy-izing.



just sorta looking for ideas, critiques, feedback, whatever :)


-Thufir





package atreides.tidyXhtml;

public interface BasicTidy{
public void setUrl(String url);
public void setOutFileName(String outFileName);
public void setErrOutFileName(String errOutFileName);
public void setXmlOut(boolean xmlOut);
}//BasicTidy
package atreides.tidyXhtml;

public class ControlTidy{


public static void main (String[] args) {
BasicTidy aTidy = new Test16();
String yahoo    = "http://www.yahoo.com/";
String google   = "http://www.google.com/";
aTidy.setUrl(yahoo);
}//main

}//ControlTidy
package atreides.tidyXhtml;

import java.io.IOException;
import java.net.URL;
import java.io.BufferedInputStream;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.io.FileWriter;
import org.w3c.tidy.Tidy;


public class Test16 implements Runnable, BasicTidy{

private String url;
private String outFileName;
private String errOutFileName;
private boolean xmlOut;

public Test16(){
this.url = "http://www.google.com/";
this.outFileName = "out.txt";
this.errOutFileName = "err.txt";
this.xmlOut = true;
}//Test16

public void run() {
URL u;
BufferedInputStream in;
FileOutputStream out;
Tidy tidy = new Tidy();

tidy.setXmlOut(xmlOut);
try {
tidy.setErrout(new PrintWriter(new
FileWriter(errOutFileName), true));
u = new URL(url);
in = new BufferedInputStream(u.openStream());
out = new FileOutputStream(outFileName);
tidy.parse(in, out);
}//try
catch ( IOException e ) {
System.out.println( this.toString() + e.toString() );
}//catch
}//run

public void setUrl (String url){
this.url = url;
}//setUrl

public void setOutFileName (String outFileName){
this.outFileName = outFileName;
}//setOutFileName

public void setErrOutFileName (String errOutFileName){
this.errOutFileName = errOutFileName;
}//setErrOutFileName

public void setXmlOut (boolean xmlOut) {
this.xmlOut = xmlOut;
}//setXmlOut

public static void main( String[] args ) {
}//main
}//Test16


Report this thread to moderator Post Follow-up to this message
Old Post
hawat.thufir@gmail.com
06-04-05 08:57 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Java Help archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:48 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.