This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Removing elements from an HTMLDocument?  RSS feed

 
Greg Whelan
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How does one remove elements from an HMTLDocument? There does not appear to be any remove/delete methods in the Element API.
Note that I'm not just trying to remove textual content, I actually want to remove a branch of the document; ie. tags+text.
Is there any other way to do this besides constructing a new HTMLDocument, ommitting the undesired portions?
 
Tom P
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two points: (1) the answer is no and (2) what does this have to do with Swing?
 
Greg Whelan
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tom. The negatory response saves me spending more time looking!
Is there an interesting explanation as to why not, or is it something that was simply not implemented?
HTMLDocument is in the Swing classes (swing.text.html.HTMLDocument is the full classname), also gets a brief discussion in O'Reilly's Swing book (p943).
 
Tom P
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It appears that the only way to remove anything from a HTMLDocument is by using the inherited remove() method.
 
Greg Whelan
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, very nice. Combined with the startOffset and endOffset properties, this then achieves what I wanted:


[This message has been edited by Greg Whelan (edited May 19, 2000).]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!