20#include <objc/objc-runtime.h>
28 if ((
self = [super
init]) != nil) {
39- (void)parseXML:(NSData*)data intoDictionary:(NSMutableDictionary*)dict
48 NSXMLParser *
parser = [[NSXMLParser alloc] initWithData:data];
50 [parser setDelegate:self];
52 [parser setShouldResolveExternalEntities:NO];
60- (void)
parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict
68 if ([elementName isEqualToString:
@"text:p"] == YES) {
79- (void)
parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
90 [textContent appendString:@" "];
94 [textContent appendString:[NSString stringWithString:runningTextContent]];
95 [runningTextContent release];
101- (void)
parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
109 [runningTextContent appendString:string];
115- (void)
parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError
118 NSLog(
@"An error occurred parsing the document. (Error %li, Description: %@, Line: %li, Column: %li)", (
long) [parseError code],
119 [[parser parserError] localizedDescription], (
long) [parser lineNumber],
120 (
long) [parser columnNumber]);
123 [runningTextContent release];
127 [textContent release];
132- (void)parserDidEndDocument:(NSXMLParser *)parser
136 [mdiValues setObject:[NSString stringWithString:textContent] forKey:(NSString*)kMDItemTextContent];
137 [textContent release];
FILE * init(int, char **)
NSMutableString * runningTextContent
NSMutableString * textContent
BOOL shouldReadCharacters
NSMutableDictionary * mdiValues