Re: [Htmlparser-user] Rebuild HTML File
Brought to you by:
derrickoswald
|
From: Mark S. <htm...@ey...> - 2006-06-26 18:35:47
|
I tried to use it this way:
Parser p = new Parser();
p.setInputHTML(normalHTML);
System.out.println(">>>>>>> "+p.parse(null).toHtml());
TestVisitor s = new TestVisitor();
p.parse(null).visitAllNodesWith(s);
System.out.println("<<<<<<<" +p.parse(null).toHtml());
In TestVisitor
public void visitStringNode (Text string)
{
string.setText("XXX");
}
The first System.out prints the original html, second System.out prints
out nothing but the "<<<<". Have you any suggestions? :)
Thanks a lot
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
>
>
|