-3

Possible Duplicate:
Spliting a string from XML formate

I am sharing a content text to evernote, it uploads successfully, but when I download the content it is display in my text-viewer like this.

<?xml version=\"1.0\" encoding=\"UTF-8\"?>
    <!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">
        <en-note> hello world </en-note>

I post my "hello world" note like this, it displays the correct "hello world" text in evernote

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];

My question is, how can i separate my downloaded text separably from the XML I get?

All I require is the text "hello world". EDIT:

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];

    }
Community
  • 1
  • 1
stackiphone
  • 1,245
  • 3
  • 19
  • 41

0 Answers0