[cp-patches] FYI: HTML parsing fix

Roman Kennke roman.kennke at aicas.com
Wed Nov 15 13:35:24 UTC 2006


This enhances the HTML parser and makes it more fault tolerant. Until
now HTML like the following would lead to a borked element structure
and/or exceptions beeing thrown:
<ul>
<li>adsa</li>
</li></li>
</ul>

(too many </li> tags).

This patch makes the parser more resistent against such code and yields
the correct structure:

<ul>
<li>adsa</li>
</ul>

... Make the planet renderable again.

2006-11-15  Roman Kennke  <kennke at aicas.com>

	* javax/swing/text/html/HTMLDocument.java
	(HTMLReader.ParagraphAction.end): Call super instead of blockClose()
	directly.
	(HTMLReader.ParagraphAction.start): Call super instead of blockOpen()
	directly.
	(HTMLReader.parseStack): Removed.
	(HTMLReader.blockClose): Simply call addContent() with ' '
	instead of doing more complicated stuff. Removed parseStack
	handling.
	(HTMLReader.blockOpen): Removed parseStack handling.
	(getInsertingReader): Removed parseStack init.
	* gnu/javax/swing/text/html/parser/htmlValidator.java
	(closeTag): Return true only when the tag actually should be
	closed.
	* gnu/javax/swing/text/html/parser/support/Parser.java
	(_handleEndTag): Only actually close the tag when the validator
	allows it.

/Roman

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-patch
Size: 12346 bytes
Desc: not available
Url : http://developer.classpath.org/pipermail/classpath-patches/attachments/20061115/b0f3178a/patch.bin


More information about the Classpath-patches mailing list