This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Handling Html tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Handling Html tag" Watch "Handling Html tag" New topic

Handling Html tag

Hui Zhao
Ranch Hand

Joined: Jul 09, 2007
Posts: 116

I have a html file that is like

I want to add an id to each line.
How to add it with html tag function?
I am not strong on it.

I need a piece of codes.
Saathvik Reddy
Ranch Hand

Joined: Jun 03, 2005
Posts: 228
Could you post more details about your question?
Joe Ess

Joined: Oct 29, 2001
Posts: 9168

The HTML parser provided in the JDK can run through a document and fire off events for each tag but it cannot edit the document. Have a look at HTMLEditorKit, which has methods for inserting and deleting content.

[How To Ask Questions On JavaRanch]
It is sorta covered in the JavaRanch Style Guide.
subject: Handling Html tag
jQuery in Action, 3rd edition