Iphone 使用
我有HTML页面的响应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
`<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);