<html>
<head>
<title>this value i want to grab</title>
</head>
<body> </body>
</html>
I have this NSString html, and I want to grab value in tag title? Can anybody help me?
<html>
<head>
<title>this value i want to grab</title>
</head>
<body> </body>
</html>
I have this NSString html, and I want to grab value in tag title? Can anybody help me?
Use NSXMLParser
, together with NSXMLParserDelegate
.
In your case it is really simple. You just watch for @"title"
in parser:didStartElement
and in parser:foundCharacters:
add the content to your own string variable, finalizing it on parser:didEndElement:
.
`](http://www.w3.org/TR/html-markup/p.html#p-tags)). Use of these features exists, is recommended by the W3C, and is not "conceptual fundamentalism".
– 一二三 Jun 19 '12 at 13:10