Re: [Htmlparser-user] Rebuild HTML File
Brought to you by:
derrickoswald
From: Derrick O. <Der...@Ro...> - 2006-06-26 22:14:59
|
I think you need something like this... Parser parser = new Parser (); parser.setInputHtml (html); NodeList list = parser.parse (null); list.visitAllNodesWith (new SegmentReplacingVisitor ()); System.out.println (list.toHtml ()); ...assuming the SegmentReplacingVisitor does the right stuff to the right nodes. Mark Stark wrote: >I dont understand. I've got a html file, manipulate some tags with my >visitor, perhaps change an attribute value. and then? serialize the >toHtml() output into a file and thats it? > >Ian Macfarlane schrieb: > > >>If you do Parser.parse() you get a NodeList, and then if you call the >>toHtml() method it will return a String of the reparsed code. >> >>Ian >> >>On 6/26/06, Mark Stark <htm...@ey...> wrote: >> >> >>>hi, >>> >>>is it possible to change certain stirngs in a html file, without >>>"rebuilding" it? I would like to change some string in a html file, like >>>a dictionary lookup, but i dont want to rebuild the html file like its >>>done in URLModifyingVisitor. >>> >>>Can anybody give me a hint? I've still got >>> >>>Parser p = new Parser(); >>>p.setInputHTML(html); >>>SegmentReplacingVisitor s = new SegmentReplacingVisitor(); >>>p.visitAllNodesWith(s); >>> >>>and do some text.setText() within the SegmentReplacingVisitor each time >>>i visit a StringNode. How to save it into a translated.htm file without >>>rebuilding it? >>> >>>thanks a lot >>> >>> >>>Using Tomcat but need to do more? Need to support web services, security? >>>Get stuff done quickly with pre-integrated technology to make your job easier >>>Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >>>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >>>_______________________________________________ >>>Htmlparser-user mailing list >>>Htm...@li... >>>https://lists.sourceforge.net/lists/listinfo/htmlparser-user >>> >>> >>> >>Using Tomcat but need to do more? Need to support web services, security? >>Get stuff done quickly with pre-integrated technology to make your job easier >>Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >>_______________________________________________ >>Htmlparser-user mailing list >>Htm...@li... >>https://lists.sourceforge.net/lists/listinfo/htmlparser-user >> >> >> >> > > > >Using Tomcat but need to do more? Need to support web services, security? >Get stuff done quickly with pre-integrated technology to make your job easier >Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >_______________________________________________ >Htmlparser-user mailing list >Htm...@li... >https://lists.sourceforge.net/lists/listinfo/htmlparser-user > > > |