我正在分享内容文本到evernote,它上传成功,但是当我下载内容时,它会在我的文本查看器中显示。
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">
<en-note> hello world </en-note>
我发布了这样的“hello world”音符,它在evernote中显示正确的“hello world”文本
for (int i = 0; i<[appDelegate.notesArray count]; i++) {
NSString * aString = [[NSString alloc] initWithString:[appDelegate.notesArray objectAtIndex:i]] ;
NSString * ENML= [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">\n<en-note>%@",aString];
ENML = [NSString stringWithFormat:@"%@%@", ENML, @"</en-note>"];
NSLog(@"%@", ENML);
// Adding the content & resources to the note
[note setContent:ENML];
我的问题是,如何将我下载的文本与我得到的XML分开?
我要求的只是文字“你好世界”。 编辑:
parser = [[NSXMLParser alloc]initWithContentsOfURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForAuxiliaryExecutable:[note content]]]];
[parser setDelegate:self];
[parser parse];
- (void)parser:(NSXMLParser *)parser
didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI
qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary
*)attributeDict
{
NSLog(@"%@", elementName);
element = [NSMutableString
string];
}
- (void)parser:(NSXMLParser *)parser
didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI
qualifiedName:(NSString *)qName {
NSLog(@": %@ : %@", elementName, element);
}
- (void)parser:(NSXMLParser *)parser
foundCharacters:(NSString *)string
{
if(element == nil)
element = [[NSMutableString
alloc] init];
[element appendString:string];
}