• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Parse text for form elements

 
James Ellis
Ranch Hand
Posts: 205
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a chunk of text which I am reading from the database which contains html. I need to pull all of the form elements from this text. Is there any cleaner way of doing this than looking for every combination of upper/lowercase form element tags? I don't want to have to look for all of these...

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Surely there is a better way to store an abstraction of these elements rather than a blob of HTML?
 
James Ellis
Ranch Hand
Posts: 205
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey I agree. Unfortunately this is the design that I am stuck working with and there is little to nothing I can do to change that.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eesh! I feel your pain.

If the HTML is well-formed, you should be able to locate a 3rd party parser that could take the parsing drudgery off your hands.
 
dema rogatkin
Ranch Hand
Posts: 294
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HTML parser supplied with Swing standard package works quite well. So you do not need even looking around.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13045
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might find the JTidy toolkit to be more powerful and flexible than the Swing HTML handlers.
Bill
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic