开发者

Use xpath (libxml2) in Objective-C

I learned the libxml2 from http://cocoawithlove.com/2008/10/using-libxml2-for-parsing-and-xpath.html Trying to parsing following html using libxml2:

<html><head></head>
<body>
<div id="content">
<h1><a href="#">Content <em>1</em> <em>2</em></a></h1>
</div>
</body>
</html>

Is there a way to get all content in h1 without detect开发者_Go百科ing all child? if I use

//div/h1/a

I only get "Content"

If I use

//div/h1/a/descendant-or-self::*

I only got the content in

Is there a way to get "Content 1 2"?

Thanks


Use this //div/h1/a/descendant-or-self::*/text().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜