in reply to Editing HTML files
From a quick perusal of HTML::Manipulator, it seems that it presupposes you have some HTML in a certain format: either with id tags (by definition these are unique) or comment markers. If you have that, great. If not, and you can't get there, then you'll have to look for another way.
Generally, I can get away with making all my HTML actually XHTML-compliant. Which then means I can whip out my favourite swiss-army knife: XML::Twig. If your HTML already is XHTML, then this becomes really easy - the complicated part will be coming up with the XPath, but that shouldn't be too hard ... something like //div[string()="nothing"] is my guess. The get_xpath function will return all the tag objects at once, and you can just loop through, change the text for each one (set_text), and print it all back out.
Otherwise, you'll probably have to roll your own with HTML::Parser...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Editing HTML files
by spivey49 (Monk) on Jul 08, 2008 at 21:33 UTC | |
by pc88mxer (Vicar) on Jul 08, 2008 at 21:49 UTC | |
by Lawliet (Curate) on Jul 08, 2008 at 21:56 UTC |