From: erjdriver on
i'm using java 1.4 and the swing parser

javax.swing.text.html.parser.

i've got a simple text file with a SPAN element - it does not parse
it.

if i replace the SPAN with P - it works.

what do i need to do for the parser to parse SPAN.

help?
From: markspace on
erjdriver wrote:
> i'm using java 1.4 and the swing parser
>
> javax.swing.text.html.parser.
>
> i've got a simple text file with a SPAN element - it does not parse
> it.
>
> if i replace the SPAN with P - it works.
>
> what do i need to do for the parser to parse SPAN.
>
> help?


I dunno if this is the same parser, but the HTML parser for JEditorPane
says HTML 3.2 is supported, which is pretty old and primitive. No
<span> element in 3.2 that I can see.


http://www.w3.org/TR/REC-html32
From: Christian Kaufhold on
erjdriver <erjdriver(a)gmail.com> wrote:

> i'm using java 1.4 and the swing parser

Why still Java 1.4?

> javax.swing.text.html.parser.
>
> i've got a simple text file with a SPAN element - it does not parse
> it.

A text file cannot contain a SPAN element :-)


> if i replace the SPAN with P - it works.

> what do i need to do for the parser to parse SPAN.

There is SPAN even in Java 1.4, but it is not recognized by the default
HTMLDocument.HTMLReader. You just need the line

registerTag(HTML.Tag.SPAN, new CharacterAction());

in a subclass of HTMLReader; but to set up things so that this Reader is
actually used requires a lot of other code (certainly I posted something
like that somewhen in comp.lang.java.gui).

But just upgrade.