Re: [Htmlparser-user] Replace LinkTag nodes with a Text node containing ~node.toString()
Brought to you by:
derrickoswald
From: Smarty <zm...@gm...> - 2006-05-21 16:14:21
|
Thank you very much. The toHtml method worked great. On 5/19/06, Derrick Oswald <Der...@ro...> wrote: > > If you want to replace all tags with plain text use the StringBean class > to return the text contents of a page. > > If it's just the LinkTag nodes you want to replace, its a bit more > complicated. > > Perhaps the easiest way would be to create your own derived LinkTag > class and override it's toHtml() method to just return the toHtml() or > toPlainTextString() of all it's children, without the enclosing <A> and > </A>. You would then register an instance of this custom tag with a > PrototypicalNodeFactory and pass the factory to the parser via > setNodeFacory(). Then when you print the toHtml() of the NodeList > returned from the parser, the overridden method is called and your tag > get's to do it's thing in the midst of the page. > > Smarty wrote: > > > > > Hi everyone. > > > > Could you please tell me the easiest way to transform all LinkTag > > nodes from a NodeList to Text nodes that contain the text of the > > link's children? > > > > From an html standpoint this should convert > > > > This is a <a href=3D''><b>link</b></a>... > > > > to > > > > This is a link... > > > > or > > > > This is a <a href=3D''><b>link</b></a>... > > > > to > > > > This is a <b>link</b>... > > > > (both ways are ok for me) > > > > > > Thanks for your time, > > Ovidiu Dan > > > > > ------------------------------------------------------- > 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 Geronim= o > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat= =3D121642 > _______________________________________________ > Htmlparser-user mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlparser-user > --=20 Ovidiu Dan, Technical Staff, Playfuls.com |