XIONG, Wenxin <[EMAIL PROTECTED]> writes:
> I am tring to make a cgi program. What i want to do is to fetch a
> HTML the user defined from other website, and translate it then
> output the result to the user. I have succeded in fetching files,
> thanks to LWP::useragent. Now, i want to do my best to keep the
> original format. it means that output translation will keep all
> previous HTML tags. I can convert HTML to plain text,which is
> required by my local machine translation system. The problem is how
> to add the HTML tag to the translation as the previous one. The
> Tokeparser is said to be the best one. But the example seems too
> simple. Could someone give me some more concrete examples on it,
> such as how to extrac the HTML tag and store it, replace the text
> chunks with the translation text.
A good start is probably to look at the 'eg/htextsub' program that
comes with HTML-Parser-3. You probably also want to translate
attributes that contain plain text (like the <img alt="...">), so you
would also need a start-handler.
Regards,
Gisle