Chat LIVE With Programming Experts! There Are 23 Online Right Now...

Welcome to Dream.In.Code
Become a Java Expert!

Join 244,309 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 848 people online right now. Registration is fast and FREE... Join Now!




using jtidy to output html web server content

 
Reply to this topicStart new topic

using jtidy to output html web server content, how to use it with a gui

markhazlett9
11 Jan, 2009 - 03:40 PM
Post #1

Student: Will Code for Food!
Group Icon

Joined: 12 Jul, 2008
Posts: 1,145



Thanked: 32 times
Dream Kudos: 25
My Contributions
Hello Everyone

I'm using the JTidy library and having some issues outputting the content to a JTextArea. I can output it fine to the console fine using this command...

java

tidy.parse(inStream, System.out);


In this code the inStream is the input html stream from the web server and the System.out is how to display it. I have tried instead of system.out to put... TextArea.setText(); but i can't do that without a string. Any ideas?

This post has been edited by markhazlett9: 11 Jan, 2009 - 03:41 PM

User is offlineProfile CardPM
+Quote Post


pbl
RE: Using Jtidy To Output Html Web Server Content
11 Jan, 2009 - 06:26 PM
Post #2

D.I.C Lover
Group Icon

Joined: 6 Mar, 2008
Posts: 6,955



Thanked: 673 times
Dream Kudos: 200
My Contributions
QUOTE(markhazlett9 @ 11 Jan, 2009 - 03:40 PM) *

Hello Everyone

I'm using the JTidy library and having some issues outputting the content to a JTextArea. I can output it fine to the console fine using this command...

java

tidy.parse(inStream, System.out);


In this code the inStream is the input html stream from the web server and the System.out is how to display it. I have tried instead of system.out to put... TextArea.setText(); but i can't do that without a string. Any ideas?

Excuse my ignorance. What is JTidy library ?
User is online!Profile CardPM
+Quote Post

BigAnt
RE: Using Jtidy To Output Html Web Server Content
11 Jan, 2009 - 08:46 PM
Post #3

May Your Swords Stay Sharp
Group Icon

Joined: 16 Aug, 2008
Posts: 2,384



Thanked: 95 times
Dream Kudos: 75
My Contributions
Well if this is what you are using there is no parse method which takes a JTextArea. It appears it will only take output streams or Writers as the place to output.
User is offlineProfile CardPM
+Quote Post

markhazlett9
RE: Using Jtidy To Output Html Web Server Content
11 Jan, 2009 - 08:59 PM
Post #4

Student: Will Code for Food!
Group Icon

Joined: 12 Jul, 2008
Posts: 1,145



Thanked: 32 times
Dream Kudos: 25
My Contributions
The Jtidy library is a third party library designed to make html code "look good" on the screen. only thing is it is designed in a way that it allows you to select an output method. All I can think of is System.out but that won't work for a JTextArea.

QUOTE(BigAnt @ 11 Jan, 2009 - 08:46 PM) *

Well if this is what you are using there is no parse method which takes a JTextArea. It appears it will only take output streams or Writers as the place to output.


Ah i see, that is highly unfortunate... can anyone think of a way around that? Any method to copy what's in the console window and put it in the GUI?

This post has been edited by markhazlett9: 11 Jan, 2009 - 09:04 PM
User is offlineProfile CardPM
+Quote Post

BigAnt
RE: Using Jtidy To Output Html Web Server Content
12 Jan, 2009 - 07:26 AM
Post #5

May Your Swords Stay Sharp
Group Icon

Joined: 16 Aug, 2008
Posts: 2,384



Thanked: 95 times
Dream Kudos: 75
My Contributions
This may be useful:

A JTextAreaWriter class which implements the Writer interface to write directtly to a JTextArea.

I haven't gotten around to trying this class yet, it was just sitting in my bookmarks for a while, so I don't know if it works correctly or not.
User is offlineProfile CardPM
+Quote Post

markhazlett9
RE: Using Jtidy To Output Html Web Server Content
12 Jan, 2009 - 08:14 AM
Post #6

Student: Will Code for Food!
Group Icon

Joined: 12 Jul, 2008
Posts: 1,145



Thanked: 32 times
Dream Kudos: 25
My Contributions
Right on! Thanks Big Ant, i'll give that a try and see if that works. Looks promising.
User is offlineProfile CardPM
+Quote Post

markhazlett9
RE: Using Jtidy To Output Html Web Server Content
12 Jan, 2009 - 01:41 PM
Post #7

Student: Will Code for Food!
Group Icon

Joined: 12 Jul, 2008
Posts: 1,145



Thanked: 32 times
Dream Kudos: 25
My Contributions
Hello All
So i took a look at the JTextAreaWriter, and i'm not exactly sure how to implement it... do I use it as a library or just a class that I call?
User is offlineProfile CardPM
+Quote Post

BigAnt
RE: Using Jtidy To Output Html Web Server Content
12 Jan, 2009 - 01:46 PM
Post #8

May Your Swords Stay Sharp
Group Icon

Joined: 16 Aug, 2008
Posts: 2,384



Thanked: 95 times
Dream Kudos: 75
My Contributions
It appears as if you create an instance of it by passing the JTextArea to write to, then when you do parse with the Tidy, just pass the JTextAreaWriter as the output.

Like I said, I do not know if this class works or not as I haven't tried it yet.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 7/4/09 07:09PM

Live Java Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month