【发布时间】:2010-11-05 12:33:26
【问题描述】:
例如:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>title</title>
</head>
<body>
<a href="aaa.asp?id=1"> I want to get this text </a>
<div>
<h1>this is my want!!</h1>
<b>this is my want!!!</b>
</div>
</body>
</html>
结果是:
I want to get this text
this is my want!!
this is my want!!!
【问题讨论】:
-
他基本上想序列化它看起来像的 HTML... 只是去掉所有标记,只留下数据。
-
与问题无关,但您绝对应该知道:结束标签中有一个“/”。例如,“
这是我想要的!!
” - 注意“”。 -
@Samir - 我相信这里的重点也是为了迎合格式错误的 html - 而不仅仅是 xhtml。
-
@Marc Gravell - 是的,这就是重点
-
使用此链接回答您的问题stackoverflow.com/questions/19523913/…