Re: ChangedCharSetException from HTMLEditorKit.Parser

2001-03-31 Thread John caron

 
 I am trying to use the javax.swing.text.html.HTMLEditorKit.Parser to
 parse some web pages (using code from Elliotte Harold's "Java Network
 Programming" 2nd ed (oreilly).
 
 I gets javax.swing.text.ChangedCharSetException on most pages because
 (it seems) Netscape Composer embeds this in each page:
 
 head
meta http-equiv="Content-Type" content="text/html;
 charset=iso-8859-1"
meta name="GENERATOR" content="Mozilla/4.76 [en] (Windows NT 5.0; U)
 [Netscape]"
meta name="Author" content="John Caron"
titleGDV WebStart/title
 /head
 
 and it seems that "text/html; charset=iso-8859-1" always causes an
 Exception.
 


Here's a brute-force workaround for this kind of problem, i just remove the offending 
lines before parsing the HTML. If anyone has more info on what 
HTMLEditorKit.ParserCallback can and cant do, or better ways to parse HTML, please 
post.

...
baseURL = new URL(urlName);
InputStream in = baseURL.openStream();
InputStreamReader r = new InputStreamReader(filterTag(in));
HTMLEditorKit.ParserCallback callback = new MyCallerBacker();
parser.parse(r, callback, false);
...

 // workaround for HTMLEditorKit.Parser, cant deal with "content-encoding"
  private InputStream filterTag(InputStream in) throws IOException {
DataInputStream dins = new DataInputStream( in);
ByteArrayOutputStream bos = new ByteArrayOutputStream(1);

DataInputStream din =  new DataInputStream(new BufferedInputStream(in));
while (din.available()  0) {
  String line = din.readLine();
  String lline = line.toLowerCase();
  if (0 = lline.indexOf("meta "))  // skip meta tags
continue;
  //System.out.println("--"+line);
  bos.write( line.getBytes());
}
din.close();

return new ByteArrayInputStream( bos.toByteArray());
  }

___
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing



Invest only $5 !

2001-03-31 Thread steve1_dunn



***VERY IMPORTANT*** Please read this message entirely at least 
once.
Read it a 2nd and even a 3rd time to make sure you understand it 
BEFORE doing
anything. If it appears familiar to you, NOTE that there are 
RADICAL
and MAJOR changes incorporated here. IT'S NEW!

Hello!

If you need to make a few thousand dollars REALLY FAST, then 
please take

a moment to read this simple program I am sharing with you. You 
DO NOT
have to send $5 to five people, buy their reports or recipes or 
anything like
that. Nor will you have to invest more money later to get things 
going.

THIS IS THE FASTEST, EASIEST PROGRAM YOU WILL EVER DO.
Spend a few hours on it and you will never forget the day you 
first
received it.

The following is a plan to benefit you and your future.

BE PREPARED TO GET EXCITED...YOU WON'T BE DISAPPOINTED!

Read the following and you will agree this is a very exciting
opportunity. Only invest a little bit of time, and your reward 
could mean thousands
of dollars! Good luck!

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
- - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - -

IT'S OUTRAGEOUS! With two hours of work I have made over 
US$11,000 in
the last three weeks, and my investment was just $5! I LOVE IT!
Thank you
11,000 times!

Julie M. St. Louis

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
- - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - -

ARE YOU IN NEED OF MONEY RIGHT NOW? HOW DOES $10,000 IN TWO WEEKS 
SOUND?

Don't laugh! Try this for a change while you wait for the others 
to
start working. One hour of work to get started and no mailing 
lists!

*
.

Esquire Marketing Newsletter Gift Club

This service is 100% legal (Refer to US Postal and Lottery Laws, 
Title
18, Section 1302 and 1341, or Title 18, Section 3005 in the US 
code, also in

the code of federal regulations, Volume 16, Sections 255 and 436, 
which
state a product or service must be exchanged for money received)

*
***

Here's How It Works!

Unlike many other programs, this three level program is more 
realistic
and much, much faster. Because it is so easy, the response rate 
for this
program is VERY HIGH AND VERY FAST, and you will see results in 
two weeks or
less!
Just in time for next month's bills! With this NEW VERSION, a 
major
objection to participation has been eliminated. NOW a BUILT-IN 
MECHANISM against
CHEATING has been introduced!

You only mail out 50 copies (not thousands as in other programs). 
You
should also send them to people who send you their programs 
because they
know these programs work and they are already believers in the 
system!

Besides, this program is MUCH, MUCH FASTER and has a HIGHER 
RESPONSE
RATE!

Even if you are already in a program, stay with it, but do 
yourself a
favor and DO THIS ONE as well. START RIGHT NOW! It's simple and 
takes a very
small investment. It will pay off long before other letters or 
programs even
begin to trickle in!

Just give ONE person a $5 payment. That's all!

Follow the simple instructions and in a few weeks you will have
THOUSANDS of DOLLARS in your bank account! Because of the LOW 
INVESTMENT, SPEED, and
HIGH PROFIT POTENTIAL, this program has a VERY HIGH RESPONSE 
RATE!
Just one (1) US$5 bill. That's your investment!

*
***

Follow These Simple Instructions

1) E-mail the person on position #4 with the subject "REMITTANCE
INQUIRY". In the body of your message, copy and paste the 
information contained in
position #3. Then below add the following question "Did you 
receive your
$5 payment from the person mentioned above? ".

2) On a blank sheet of paper write "Please add me to your 
conformation list and 
E-mail me to confirm your receipt of my $5 remittance". Write 
your name and 
address and include your email address (WRITE CLEARLY) for 
confirmation
mailing and courtesy follow-ups. Fold it around a US$5 and send 
it to the FIRST
name on the list (#1).  ***SEND CASH IN US FUNDS ONLY***

IMPORTANT: Wrap additional paper (black colored paper is ideal) 
so that
the $5 inside can not be seen when your letter is held against a 
strong
light. This is to prevent thievery!

Only the first person on the list gets your name and a $5 US 
payment.

Now your ready to prepare your letter for mailing.

3) COPY and PASTE the names and addresses as follows CAREFULLY. 

Move the #3 NAME and ADDRESS to the #2 position.
Move the #2 NAME and ADDRESS to the #1 position.
Move the #1 NAME and ADDRESS to the #4 position.
Add your NAME and ADDRESS to the #3 position. 
NOTE: Only the fourth (#4) name in the original list is dropped.

4) AFTER you have received the e-mail confirming receipt of your
payment (you may make a courtesy follow-up after 1 week if 
necessary), SEND out
50 or more copies of your 

super layout manager help

2001-03-31 Thread Steve Barrett

Attached is source for a layout manager I am working
on.  Its intended to be fairly simply to use and very
extensible.  My approach was to write a layout manager
than can handle all kinds of customized constraint
objects.  I want to provide a useful set of constraint
objects to go with it.  I've only written three so
far.
It's not even beta, but I would appreciate testing,
suggestions, etc.
SO any help would be appreciated.  
Thanks in advance, Steve Barrett

__
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/?.refer=text
 test.zip