Slide 40
Slide 40 text
UW04Ͱ8FCϖʔδӾཡ
ࢀߟɿ)5.-Λ57.-ʹม͢Δ 0CKFDUJWF$
- (NSString* )getTvml: (NSString* )html {
const char* buffer = [html UTF8String];
htmlDocPtr doc = htmlReadMemory(buffer, (int)html.length, "", "UTF-8", 0);
xmlNodePtr root = xmlDocGetRootElement(doc);
NSMutableString* mutableString = [NSMutableString stringWithString:@" .topLeftLogo { tv-
position: top-left; color:rgb(255,255,255); tv-text-style: headline; }"];
[mutableString appendFormat:@"%@", [self parseTag:root]];
return mutableString;
}
- (NSString *)parseTag: (htmlNodePtr)ptr {
NSMutableString* mutableString = [NSMutableString string];
for (htmlNodePtr node = ptr; node != NULL; node = node->next) {
switch (node->type) {
case XML_ELEMENT_NODE:
if(node->children != NULL) {
NSString* ret = [self parseTag:node->children];
[mutableString appendString:ret];
}
break;
case XML_TEXT_NODE:
if (node->content != NULL) {
NSString* content = [[NSString stringWithUTF8String:(char *)node->content]
stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
if (content.length != 0) {
[mutableString appendFormat:@"%@", content];
}
}
default:
break;
}
}
return mutableString;
}
MJCYNM)5.-QBSTFSΛͬͨ57.-ม