Objective-C HTML解析。获取<pre>

时间:2018-12-27 12:53:07

标签: objective-c parsing hpple

I am using hpple to get some information from a website.

<form method=post action=/bg/move/3972064/820>
<input type=hidden name=commit value=1>
<b><i>Chat:</i></b>
<PRE>&gt;ich bräuchte mal eine text im Chat :-)
    &gt;
    &gt;merry Christmas from Florida

    Fröhliche Weihnachten aus Hamburg :)
</PRE>
<input type=checkbox name=quote checked> Quote previous message<BR>
<textarea name=chat rows=5 cols=80 wrap=physical></textarea>
<br>
<p>
<input type=submit name=submit value="Next Game"> 
<input type=submit name=submit value="To Top">
</form>

All works fine, but I can't find the text between "< PRE>" and "< /PRE>"???

I read the form with

NSData *matchHtmlData = [NSData dataWithContentsOfURL:urlMatch];
TFHpple *xpathParser = [[TFHpple alloc] initWithHTMLData:matchHtmlData];
NSArray *elements  = [xpathParser searchWithXPathQuery:@"//form[1]"];

In this array "elements" is all Information from that form except of the Information between pre-tags ? how can i get the Information between pre-tags?

Edit: I found out, that text with "normal" characters are no problem! Only text with some characters as "ä" or "ö" (typical german) is the problem

how to encode this for hpple?

0 个答案:

没有答案