我正在尝试从字符串中删除所有 HTML 元素。不幸的是,我不能使用正则表达式,因为我是在黑莓平台上开发的,还不支持正则表达式。
有没有其他方法可以从字符串中删除 HTML?我在某处读到您可以使用 DOM Parser,但我找不到太多关于它的信息。
带有 HTML 的文本:
<![CDATA[As a massive asteroid hurtles toward Earth, NASA head honcho Dan Truman (<a href="http://www.netflix.com/RoleDisplay/Billy_Bob_Thornton/20000303">Billy Bob Thornton</a>) hatches a plan to split the deadly rock in two before it annihilates the entire planet, calling on Harry Stamper (<a href="http://www.netflix.com/RoleDisplay/Bruce_Willis/99786">Bruce Willis</a>) -- the world's finest oil driller -- to head up the mission. With time rapidly running out, Stamper assembles a crack team and blasts off into space to attempt the treacherous task. <a href="http://www.netflix.com/RoleDisplay/Ben_Affleck/20000016">Ben Affleck</a> and <a href="http://www.netflix.com/RoleDisplay/Liv_Tyler/162745">Liv Tyler</a> co-star.]]>
没有 HTML 的文本:
当一颗巨大的小行星冲向地球时,美国宇航局局长丹·杜鲁门 (比利·鲍勃·桑顿饰) 制定了一项计划,在这颗致命的岩石毁灭整个星球之前将其一分为二,并呼吁世界上最好的石油钻探员哈里·斯坦普 (布鲁斯·威利斯饰) ——领导任务。随着时间的流逝,斯坦普组建了一支精锐的团队,并飞向太空以尝试这项危险的任务。本·阿弗莱克和丽芙·泰勒联合主演。
谢谢!