input stream 101



" The entry point for accessing JTidy functionalities is the
org.w3c.tidy.Tidy class. This is a simple example of use:


Tidy tidy = new Tidy(); // obtain a new Tidy instance
tidy.setXHTML(boolean xhtml); // set desired config options using tidy
setters
.... // (equivalent to command line options)

tidy.parse(inputStream, System.out); // run tidy, providing an input
and output stream"

<http://jtidy.sourceforge.net/howto.html>



I have:

[thufir@arrakis java]$ date
Mon Aug 1 02:46:14 IST 2005
[thufir@arrakis java]$ pwd
/home/thufir/java
[thufir@arrakis java]$ ant
Buildfile: build.xml
Overriding previous definition of reference to tidy.path

clean:
[delete] Deleting directory /home/thufir/java/bin

prepare:
[mkdir] Created dir: /home/thufir/java/bin

compile:
Overriding previous definition of reference to tidy.path

doCompile:
[javac] Compiling 3 source files to /home/thufir/java/bin
[javac]
/home/thufir/java/src/atreides/tidyXhtml/ControlTidy.java:17: '.class'
expected [javac] aTidy.setXHTML(boolean xhtml);
[javac] ^
[javac]
/home/thufir/java/src/atreides/tidyXhtml/ControlTidy.java:17: ')'
expected
[javac] aTidy.setXHTML(boolean xhtml);
[javac] ^
[javac] 2 errors

BUILD FAILED
/home/thufir/java/build.xml:19: The following error occurred while
executing this line:
/home/thufir/java/build.xml:31: Compile failed; see the compiler error
output for details.

Total time: 4 seconds
[thufir@arrakis java]$ cat src/atreides/tidyXhtml/ControlTidy.java -n
1 package atreides.tidyXhtml;
2
3 public class ControlTidy{
4
5 public static void main (String[] args) {
6 String yahooUrl =
"http://www.yahoo.com/";;
7 String googleUrl =
"http://www.google.com/";;
8 String out = "out.txt";
9 String err = "err.txt";
10 boolean xml = true;
11 Test16 aTidy = new Test16();
12
13 aTidy.setUrl (yahooUrl);
14 aTidy.setOutFileName (out);
15 aTidy.setErrOutFileName (err);
16 aTidy.setXmlOut(xml);
17 aTidy.setXHTML(boolean xhtml);
18 aTidy.parse(inputStream, System.out.println());
19
20 Thread aTidyThread = new Thread(aTidy);
21 aTidyThread.start();
22
23 }//main
24 }//ControlTidy
[thufir@arrakis java]$



looking at line 17, what's the (boolean xhtml) mean? Is the boolean
primitive variable xhtml being declared, or passed?


I thought it might be that I have an old version of Tidy.jar so I
downloaded the most recent version, same problem. Then I took out the
"boolean" and that didn't do anything, either.

It's like there's no Tidy.setXHTML method, if I follow the error
messages.

[thufir@arrakis java]$
[thufir@arrakis java]$
[thufir@arrakis java]$ date
Mon Aug 1 02:54:18 IST 2005
[thufir@arrakis java]$ pwd
/home/thufir/java
[thufir@arrakis java]$ ant
Buildfile: build.xml
Overriding previous definition of reference to tidy.path

clean:
[delete] Deleting directory /home/thufir/java/bin

prepare:
[mkdir] Created dir: /home/thufir/java/bin

compile:
Overriding previous definition of reference to tidy.path

doCompile:
[javac] Compiling 3 source files to /home/thufir/java/bin
[javac]
/home/thufir/java/src/atreides/tidyXhtml/ControlTidy.java:18: cannot
find symbol
[javac] symbol : method setXHTML(boolean)
[javac] location: class atreides.tidyXhtml.Test16
[javac] aTidy.setXHTML(xhtml);
[javac] ^
[javac]
/home/thufir/java/src/atreides/tidyXhtml/ControlTidy.java:19: cannot
find symbol
[javac] symbol : variable inputStream
[javac] location: class atreides.tidyXhtml.ControlTidy
[javac] aTidy.parse(inputStream, System.out.println());
[javac] ^
[javac]
/home/thufir/java/src/atreides/tidyXhtml/ControlTidy.java:19: 'void'
type not allowed here
[javac] aTidy.parse(inputStream, System.out.println());
[javac]
^
[javac] 3 errors

BUILD FAILED
/home/thufir/java/build.xml:19: The following error occurred while
executing this line:
/home/thufir/java/build.xml:31: Compile failed; see the compiler error
output for details.

Total time: 5 seconds
[thufir@arrakis java]$ cat src/atreides/tidyXhtml/ControlTidy.java -n
1 package atreides.tidyXhtml;
2
3 public class ControlTidy{
4
5 public static void main (String[] args) {
6 String yahooUrl =
"http://www.yahoo.com/";;
7 String googleUrl =
"http://www.google.com/";;
8 String out = "out.txt";
9 String err = "err.txt";
10 boolean xml = true;
11 boolean xhtml = true;
12 Test16 aTidy = new Test16();
13
14 aTidy.setUrl (yahooUrl);
15 aTidy.setOutFileName (out);
16 aTidy.setErrOutFileName (err);
17 aTidy.setXmlOut(xml);
18 aTidy.setXHTML(xhtml);
19 aTidy.parse(inputStream, System.out.println());
20
21 Thread aTidyThread = new Thread(aTidy);
22 aTidyThread.start();
23
24 }//main
25 }//ControlTidy
[thufir@arrakis java]$




What I want is to make a jar with the url hard-coded, line 14
"aTidy.setUrl (yahooUrl)", which the Tidy jar will then parse, with
output to a file, or the screen, whatever.

Do I need an input stream? There's an undefined symbol for that. I
already defined the url, the OutFileName, etc, what else is required?


Thanks for any pointers,


Thufir

.



Relevant Pages

  • Re: input stream 101
    ... Do you have previous experience programming in Java? ... Then again, your code mentions Test16. ... aTidy is then of type Test16. ...
    (comp.lang.java.help)
  • Re: Java and make
    ... I have a question about using make as the build-utilitiy for Java ... My makefile captures this as: ... javac NetworkPacket.java ... make discovers a cyclic dependency and drops it. ...
    (comp.lang.java.programmer)
  • Re: input stream 101
    ... Do you have previous experience programming in Java? ... Then again, your code mentions Test16. ... been doing that method call on an object of type Test16. ...
    (comp.lang.java.help)
  • Re: Free download javac
    ... I have javac on one computer, but I need to transfer to some ... > download javac, restart the computer, and type in javac *.java into my ... > anyone has a link to download the java Compiler, not the java SDK, I would ... and install it on each machine? ...
    (comp.lang.java.programmer)
  • Re: Compile Java Program
    ... > I recently bought Sam's Teach yourself Java in 21 days. ... > the Ms-Dos command prompt and to type in Javac Ellsworth.java in the ... I did this and it said that javac is not ... I have seen situations where the classpath ...
    (comp.lang.java.help)