xml を解析する Xcode でアプリケーションを作成していますが、このコードの解析に問題があります。
<description>
<![CDATA[
<object type="application/x-shockwave-flash" data="http://www.youtube.com/v/Sg8z_On_Jmc?fs=1" width="580" height="25"> <param name="movie" value="http://www.youtube.com/v/Sg8z_On_Jmc?fs=1" /> <param name="allowFullScreen" value="true" /> </object>
]]>
</description>
データまたは値で URL を取得するにはどうすればよいですか?
ありがとう。
私のソースコード: .M
//didStartElement の最初に;
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
{
if (![self currentStringValueTitle]) {
[self setCurrentStringValueTitle:[[NSMutableString alloc] initWithCapacity:50]];
}
if (![self currentStringValueImage]) {
[self setCurrentStringValueImage:[[NSMutableString alloc] initWithCapacity:50]];
}
if (![self currentStringValueDescription]) {
[self setCurrentStringValueDescription:[[NSMutableString alloc] initWithCapacity:50]];
}
[[self currentStringValueTitle] appendString:string];
[[self currentStringValueDescription] appendString:string];
[[self currentStringValueImage] appendString:string];
NSLog(@"Başlık: %@", [self currentStringValueTitle]);
NSLog(@"Detay: %@", [self currentStringValueDescription]);
}
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{
if ( [elementName isEqualToString:@"title"] ) {
[[self titleArray] addObject:[self currentStringValueTitle]];
}
if ( [elementName isEqualToString:@"pubDate"] ) {
[[self descriptionArray] addObject:[self currentStringValueDescription]];
}
if ( [elementName isEqualToString:@"description"] ) {
[[self imageArray] addObject:[self currentStringValueImage]];
}
[self setCurrentStringValueTitle:nil];
[self setCurrentStringValueDescription:nil];
[self setCurrentStringValueImage:nil];
}