static void test3()
	{
		try
		{
			Reader in = new StringReader(
				"<P><B>Please contact Public Affairs Division for the text of the paper	" +
				"&amp; the authors for further comment</B> </P> " +
				"a &amp; b" +
				"a AT&T&amp b" +
				"a &amp&amp b" +
				"a &lt&amp b" +
				"a &amp&gt b" +
				""
				);

			HtmlStreamTokenizer tok = new HtmlStreamTokenizer(in);
			HtmlTag tag = new HtmlTag();
			while (tok.nextToken() != HtmlStreamTokenizer.TT_EOF)
			{
				StringBuffer buf = tok.getWhiteSpace();
				if (buf.length() > 0)
					System.out.print(buf.toString());

				if (tok.getTokenType() == HtmlStreamTokenizer.TT_TAG)
				{
					try
					{
						tok.parseTag(tok.getStringValue(), tag);
						if (tag.getTagType() == HtmlTag.T_UNKNOWN)
							throw new HtmlException("unkown tag");
						System.out.print(tag.toString());
					}
					catch (HtmlException e)
					{
						// invalid tag, spit it out
						System.out.print("\ninvalid: ");
						System.out.print("<" + tok.getStringValue() + ">");
						System.out.println("");
					}
				}
				else
				{
					buf = tok.getStringValue();
					HtmlStreamTokenizer.unescape(buf);
					if (buf.length() > 0)
						System.out.print(buf.toString());
				}
			}

			// hang out for a while
			System.in.read();
		}
		catch (Exception e)
		{
			System.out.println(e.getMessage());
		}
	}