javax.swing.text.HTMLDocument getIterator returns null for some Tags
From: Jim Cobban (jcobban_at_magma.ca)
Date: 11/19/04
- Next message: Jim Cobban: "Get Title for HTMLDocument in JEditorPane"
- Previous message: Bastian Hammer: "Re: Navigation around different JFrames"
- Next in thread: hiwa: "Re: javax.swing.text.HTMLDocument getIterator returns null for some Tags"
- Reply: hiwa: "Re: javax.swing.text.HTMLDocument getIterator returns null for some Tags"
- Reply: Thomas Weidenfeller: "Re: javax.swing.text.HTMLDocument getIterator returns null for some Tags"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 19 Nov 2004 12:53:47 -0500
I have encountered a problem which is reported multiple times in this
discussion group, and over in .programmer as well. That is that
HTMLDocument.getIterator mysteriously returns a null value for some tag
types, while working, equally mysteriously, for other tag types. In all
cases instead of responses addressing the problem itself the user has been
advised of some more or less obscure workaround.
The problem reports go back over 8 years, and since HTMLDocument.getIterator
continues to behave in the same way, I must assume that it is operating as
designed. However if it is so, then why has the documentation not been
updated to reflect that the intent is that getIterator will return null for
some tag types, and with a list of those tag types for which it does work
added to the documentation?
Obviously whoever wrote the code did so to solve some specific requirement,
and as soon as it had addressed that requirement the code was shoved to the
back burner. It certainly is a peculiar interface, since a normal iterator
mechanism provides access to the components that are being iterated over,
whereas this interface provides access only to some, not all, of the
information that would be available if the iterator provided access to the
Elements themselves. But then the entire HTMLDocument interface seems
clumsy and poorly thought out compared to the XML DOM and SAX interfaces.
The XML DOM interface, by contrast, provides clear standarized ways to get
to and iterate over particular tag types and the attributes under them,
which are not provided by the HTMLDocument interface. This forces every
developer to reinvent the wheel, which is contrary to the philosophy
espoused in the Java API as a whole.
I just wish that the documentation warned users not to waste time trying to
use getIterator where it is not going to work. Certainly if the community
has no intention of making getIterator work for all tag types, not just some
mysterious and undocumented subset, then the method should at least be
deprecated.
- Next message: Jim Cobban: "Get Title for HTMLDocument in JEditorPane"
- Previous message: Bastian Hammer: "Re: Navigation around different JFrames"
- Next in thread: hiwa: "Re: javax.swing.text.HTMLDocument getIterator returns null for some Tags"
- Reply: hiwa: "Re: javax.swing.text.HTMLDocument getIterator returns null for some Tags"
- Reply: Thomas Weidenfeller: "Re: javax.swing.text.HTMLDocument getIterator returns null for some Tags"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|