Re: input stream 101



Hemal Pandya wrote:

....

> They both have the same end result if you are using only the first line
> from the two I wrote above. I did not say what I wrote is better. But
> this is not equivalent to:
> tidy.setXHTML(boolean xhtml);

> Because the above line has no meaning.

Ok, I also thought that the instruction from the JTidy page was
non-sensical, but I posted it because it seemed possible that I just
didn't know the meaning.

I suppose that the correct instruction would be:

tidy.setXHTML(boolean); //indicating that a boolean should be passed

I'm not sure what you the point of passing true/false is versus passing
a boolean variable. I tried both true and false, got the same error.
Pardon, I don't follow what you're getting at.

> > ...
> > > I am not sure how far you will go if this is what the error messages
> > > suggest to you. Do you have previous experience programming in Java?

> > Well, one small step at a time :)

> Best of luck. But I dare say this is not the correct route for learning
> to program either. Then again, your code mentions Test16. Is this a
> class project?

No, it's for personal use.

....

> What is Test16 and why are you calling methods on it? I thought aTidy
> was an instance of Tidy.

AHA! at <http://jtidy.sourceforge.net/howto.html> in that method call,
"tidy.setXHTML(boolean);", the "tidy" object is of type Tidy. I've
been doing that method call on an object of type Test16. Ok, that
help's quite a bit, actually. There's no method by that name in
Test16, but (I assume) there is in the Tidy class.

Test16 is the name of the sample code at
<http://sourceforge.net/docman/ display_doc.php?docid=1298&gro
up_id=13153>
Which I've modified very slightly.

//from ControlTidy.java
Test16 aTidy = new Test16();
//better name, changed that line
Test16 aTest16 = new Test16();
//I had tried to make an interface for aTest16, but for right now
//I'm just trying to get a clean compile.

aTidy is then of type Test16. Hmm, that is a bad name, aTidy once was
of type Tidy and I kept the name but changed the type. Thanks for
bringing attention to that, I've renamed it aTest16.

What I'm aiming for is to hardcode the URL (Yahoo/Google/whatever) as
well as where to direct the output, then put all that into a jar. I
put it in a jar, but nothing happens when the jar is executed, so it's
back to the source code for the ControlTidy class.

Here's ControlTidy.java with aTidy changed to aTest16 :

[thufir@arrakis java]$ date
Mon Aug 1 09:28:46 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(false);
[javac] ^
[javac]
/home/thufir/java/src/atreides/tidyXhtml/ControlTidy.java:19: cannot
find symbol
[javac] symbol : variable inputStream
[javac] location: class java.lang.Object
[javac] aTidy.parse(java.lang.Object.inputStream,
System.out);
[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: 12 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(false);
19 aTidy.parse(java.lang.Object.inputStream,
System.out);
20
21 Thread aTidyThread = new Thread(aTidy);
22 aTidyThread.start();
23
24 }//main
25 }//ControlTidy
[thufir@arrakis java]$

Thanks,

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: Novice linux java coder needs help getting progs to run
    ... So it works in the opposite way to the java runtime command line unless you ... manipulate files; the purpose of the "java" command is to manipulate ... So when you specify "javac Hello" you are telling the compiler to ... There are no options to subvert the purposes of these utilities. ...
    (comp.lang.java.programmer)
  • 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)