Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 使用_Iphone_Html_Objective C_Html Parsing - Fatal编程技术网

Iphone 使用

Iphone 使用,iphone,html,objective-c,html-parsing,Iphone,Html,Objective C,Html Parsing,我有HTML页面的响应 `<cite>www.<b>apple</b>.com/in/</cite>` 但是我没有得到完整的文本,它只是从中获取“www”。请建议一些东西来获得标签中的完整文本。文本只提供一个元素的文本。它忽略了可能存在的任何孩子 引用 TextNode:www b text节点:苹果 TextNode:.com/in/ 要获得城市标记下的所有文本,忽略其间的任何标记,我认为应该这样做 @interface

我有HTML页面的响应

     `<cite>www.<b>apple</b>.com/in/</cite>`

但是我没有得到完整的文本,它只是从中获取“www”。请建议一些东西来获得标签中的完整文本。

文本只提供一个元素的文本。它忽略了可能存在的任何孩子

  • 引用
    • TextNode:www
    • b
      • text节点:苹果
    • TextNode:.com/in/
要获得城市标记下的所有文本,忽略其间的任何标记,我认为应该这样做

@interface THppleElement (textInlcudingChildren)
- (NSString*)textInlcudingChildren;
@end

@implementation THppleElement (textInlcudingChildren)
- (NSString*)textInlcudingChildren {
    NSMutableString *txt = self.text;
    for(id child in self.children)
        [txt appendString:[child textInlcudingChildren]];
    return txt;
}
@end
...

NSString * text = [element7 textInlcudingChildren];
NSLog(@"%@", text);
@interface THppleElement (textInlcudingChildren)
- (NSString*)textInlcudingChildren;
@end

@implementation THppleElement (textInlcudingChildren)
- (NSString*)textInlcudingChildren {
    NSMutableString *txt = self.text;
    for(id child in self.children)
        [txt appendString:[child textInlcudingChildren]];
    return txt;
}
@end
...

NSString * text = [element7 textInlcudingChildren];
NSLog(@"%@", text);