I am using a website to find if a word exists or not in the romanian language. So i am creating an NSXMLParser
with the following url: http://dexonline.ro/definitie/caine
But the parser goes through the <head>
element names and not through the <body>
and i cant tell if the word was found.
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict {
NSLog(@"%@",elementName);
}
The parser never reaches the body. What can i do ?
NSXMLParser
is probably not the correct tool for the job. It requires accurate XML input and often HTML from websites isn't accurate enough (missing tags / bad encoding / etc).
Instead, you may want to:
NSScanner
to locate and extract your content