i am sharing a note to evernote by using the evernote api,it is sucess,it uploade the note to evernote.but when i download the Note from the evernote to my application it is giving me note in xml formate.my code for sending note is . IN my button click {
我正在通过使用evernote api与evernote共享一张便条,它是成功的,它将笔记上传到evernote。但是当我从evernote下载笔记到我的应用程序时,它正在给我注释xml formate.my代码用于发送笔记是。点击我的按钮{
EDAMNote * note = [[[EDAMNote alloc] init]autorelease];
note.title = @"Appname";
NSMutableString *str = [[NSMutableString alloc] initWithString:@"NOTES:"];
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];
}
it will send the value of aString
correctly to evernote. and my Downloding code is
它会正确地将aString的值发送到evernote。我的Downloding代码是
- (void)viewDidLoad
{
[super viewDidLoad];
// Load the EDAMNote object that has guid we have stored in the object
EDAMNote * note = [(Evernote *)[Evernote sharedInstance] getNote:guid];
// Changing the navigation title & the content block
noteNavigation.topItem.title = [note title];
//adding note to textview
noteContent.text = [note content];
// Adding a back button to close the windows
UIBarButtonItem* doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(goBack:)];
UINavigationItem *item = [[[UINavigationItem alloc] init] autorelease];
item.leftBarButtonItem = doneButton;
item.hidesBackButton = YES;
[noteNavigation pushNavigationItem:item animated:NO];
noteNavigation.topItem.title = [note title];
}
it downloeds correctly but it shows the note with like this
它正确地下载但是它显示了这样的音符
<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">\n<en-note> then our noteeeee in this areaaa>
but i want this only then our noteeeee in this areaaa
in the textview.how to filter this?
但是我想要这个只有我们在textview.how中的这个区域的noteeeee过滤这个?
3 个解决方案
#1
1
One way to do that would be to use NSXMLParser. If the only thing you care about is that one line, then it'll be easy to write your parser delegate. All you'll need are:
一种方法是使用NSXMLParser。如果您唯一关心的是那一行,那么编写解析器委托就很容易了。你所需要的只是:
-
a variable (use an NSMutableString) to hold the text, perhaps called
noteText
一个变量(使用NSMutableString)来保存文本,可能称为noteText
-
a
-parser:didStartElement:namespaceURI:qualifiedName:attributes:
method to clearnoteText
when you get the<en-note>
taga -parser:didStartElement:namespaceURI:qualifiedName:attributes:获取
标记时清除noteText的方法 -
a
-parser:foundCharacters:
method to add found characters tonoteText
a -parser:foundCharacters:将找到的字符添加到noteText的方法
-
a
-parser:didEndElement:namespaceURI:qualifiedName:
method to do something withnoteText
when it gets a</en-note>
taga -parser:didEndElement:namespaceURI:qualifiedName:在获取 标记时使用noteText执行某些操作的方法
#2
#3
0
Apple has two built in solutions for parsing XML data on the iphone. The objective-c implementation of an XML parser called NSXMLParser and a C based implementation of an XML parser called libXML2.
Apple有两个内置的解决方案,用于解析iphone上的XML数据。 XML解析器的目标c实现,称为NSXMLParser,以及基于C的XML解析器实现,称为libXML2。
Edit:
This article shows you how to parse XML using the NSXMLParser
本文介绍如何使用NSXMLParser解析XML
http://www.codeproject.com/Articles/248883/Objective-C-Fundamentals-NSXMLParser
#1
1
One way to do that would be to use NSXMLParser. If the only thing you care about is that one line, then it'll be easy to write your parser delegate. All you'll need are:
一种方法是使用NSXMLParser。如果您唯一关心的是那一行,那么编写解析器委托就很容易了。你所需要的只是:
-
a variable (use an NSMutableString) to hold the text, perhaps called
noteText
一个变量(使用NSMutableString)来保存文本,可能称为noteText
-
a
-parser:didStartElement:namespaceURI:qualifiedName:attributes:
method to clearnoteText
when you get the<en-note>
taga -parser:didStartElement:namespaceURI:qualifiedName:attributes:获取
标记时清除noteText的方法 -
a
-parser:foundCharacters:
method to add found characters tonoteText
a -parser:foundCharacters:将找到的字符添加到noteText的方法
-
a
-parser:didEndElement:namespaceURI:qualifiedName:
method to do something withnoteText
when it gets a</en-note>
taga -parser:didEndElement:namespaceURI:qualifiedName:在获取 标记时使用noteText执行某些操作的方法
#2
0
You can implement the NSXMLParserDelegate and parse de xml. You can find many samples around like this or this
您可以实现NSXMLParserDelegate并解析de xml。您可以在此处或此处找到许多样本
#3
0
Apple has two built in solutions for parsing XML data on the iphone. The objective-c implementation of an XML parser called NSXMLParser and a C based implementation of an XML parser called libXML2.
Apple有两个内置的解决方案,用于解析iphone上的XML数据。 XML解析器的目标c实现,称为NSXMLParser,以及基于C的XML解析器实现,称为libXML2。
Edit:
This article shows you how to parse XML using the NSXMLParser
本文介绍如何使用NSXMLParser解析XML
http://www.codeproject.com/Articles/248883/Objective-C-Fundamentals-NSXMLParser