Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 562869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:36:00+00:00 2026-05-13T12:36:00+00:00

I’m having strange problems parsing (apparently) correct XML code! The xml parsed is: <?xml

  • 0

I’m having strange problems parsing (apparently) correct XML code!

The xml parsed is:

<?xml version="1.0" encoding="UTF-8" ?>
<root>
<results>
<file id="0" name="   Linux Ubuntu.rar                                                                  700.64     2" size="700" disp="2"/>
<file id="1" name="   [Soft] Sistema operativo Linux. Live CD Distro Ubuntu-5.04-live-i386.iso          624.926     4" size="5" disp="4"/>
<file id="2" name="   ubuntu-9.04-server-i386.iso                                                       577.220     2" size="9" disp="2"/>
<file id="3" name="   virtualbox-3.1_3.1.2-56127_Ubuntu_karmic_amd64.deb                                 43.578     1" size="3" disp="1"/>
<file id="4" name="   [APP-ITA].UBUNTU.LINUX.iso                                                        586.822     2" size="586" disp="2"/>
<file id="5" name="   Ubuntu linux 2007.iso                                                             700.446     1" size="700" disp="1"/>
<file id="6" name="   Installare aMule Adunanza + Liste Server + Liste Nodi su Ubuntu Gutsy [Fastweb      0.72     5" size="0" disp="5"/>
<file id="7" name="   - Guida Per Linux Ubuntu 7.03 Facile Da Usare!!!!!!!La Prima In Ita.rar           731.351     3" size="7" disp="3"/>
<file id="8" name="   Ubuntu Hacks - Tips and Tools for Exploring, Using, and Tuning Linux (O'Reilly,     3.494     1" size="3" disp="1"/>
<file id="9" name="   Linux-ubuntu-8.04.1-desktop-i386.iso                                              694.498     3" size="8" disp="3"/>
<file id="10" name="   [MANUALE] Ubuntu Linux - Computer Magazine.pdf                                     86.992     2" size="86" disp="2"/>
<file id="11" name="   (Ebook - Ita - Software) Ubuntu - Desktop Guide.pdf                                 0.686     3" size="0" disp="3"/>
<file id="12" name="   Installare Amule Adunanza In Ubuntu.rar                                             0.25     6" size="0" disp="6"/>
<file id="13" name="   UBUNTU LINUX [ITA].PDF                                                              0.536     62" size="0" disp="62"/>
<file id="14" name="   Comandi Fondamentali Ubuntu.rtf                                                     0.67     4" size="0" disp="4"/>
<file id="15" name="   ubuntu Guida.tar                                                                    0.160     1" size="0" disp="1"/>
<file id="16" name="   ubuntu-remix-italiano-8.10.iso                                                    702.720     1" size="8" disp="1"/>
</results>
</root>

NSXMLParser gives me the following error:

2010-01-13 20:23:22.500 iMule[1419:20b] Error 65, Description: (null), Line: 13, Column: 24
2010-01-13 20:23:22.516 iMule[1419:20b] Error 4, Description: (null), Line: 1, Column: 1

The funny thing is that, if i parse these lines singularly i have no problems, the parser dosent fuss at all!

My parsing code is:

    // DELEGATE XML PARSER

- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName     namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName   attributes:(NSDictionary *)attributeDict{
    if([elementName isEqualToString:@"downloads"] || [elementName isEqualToString:@"results"]){
    NSLog(@"starting or downloads or results");
    if(xmlArray){
        xmlArray= nil;
    }
    self.xmlArray= [[NSMutableArray alloc] init];
    if([elementName isEqualToString:@"results"]){
        [self.results_controller.activity startAnimating];
    }
    if([elementName isEqualToString:@"downloads"]){
        [self.downloads_Controller.activity startAnimating];
    }
}
else if([elementName isEqualToString:@"file"]){
    NSLog(@"found file...");
    [self.xmlArray addObject:attributeDict];
}
}

 - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{
NSLog(elementName);
if([elementName isEqualToString:@"downloads"] || [elementName isEqualToString:@"results"]){
    if([elementName isEqualToString:@"downloads"]){
        NSLog(@"downloads found...  reloading table");
        self.downloads_Controller.downloads= xmlArray;
        [self.downloads_Controller.tableView reloadData];
        [self.downloads_Controller.activity stopAnimating];
    }
    else if([elementName isEqualToString:@"results"]){
        NSLog(@"results found... reloading table");
        self.results_controller.results= xmlArray;
//          NSLog(@"xmlarray: %@ and results: %@", xmlArray, self.results_controller.results);
        [self.results_controller.tableView reloadData];
        [self.results_controller.activity stopAnimating];
    }
}
else if([elementName isEqualToString:@"error"]){
    UIAlertView *alert= [[UIAlertView alloc] initWithTitle:@"Error" message:@"aMule dosent seem to be on" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [alert show];
    [alert release];
}
}

- (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError{
NSLog(@"Error %i, Description: %@, Line: %i, Column: %i", [parseError code],
      [[parser parserError] localizedDescription], [parser lineNumber],
      [parser columnNumber]);
 }

- (void)parser:(NSXMLParser *)parser validationErrorOccurred:(NSError *)validError{
NSLog(@"valid: %@", validError);
}


// END DELEGATES XML PARSER

Does someone have a clue of what it could be?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T12:36:00+00:00Added an answer on May 13, 2026 at 12:36 pm

    When you say “parse these lines singularly” do you mean you handed it a complete XML document with only a single “file” entry? If that’s the case, then another approach would be to set up the XML document with two “file” entries, one with file 0 and file 1, one with file 1 and file 2, one with file 2 and file3, etc., and see if all pairs work correctly. Depending on how you’re passing the XML into the parser, you may have a problem that only shows up when parsing successive file entries.

    Depending on how long your parsing code is, it would be helpful for you to add it to the original post.

    This short program parses your supplied data just fine with NSXMLParser:

    #import <Foundation/Foundation.h>

    int
    main()
    {
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

    NSData *xml = [NSData dataWithContentsOfFile: @"data.xml"];
    NSLog(@"xml: %@", [[NSString alloc] initWithData: xml encoding: NSASCIIStringEncoding]);
    
    NSXMLParser *parser = [[NSXMLParser alloc] initWithData: xml];
    if (!parser)
        NSLog(@"Unable to initialize parser");
    else if ([parser parse])
        NSLog(@"Parsed successfully");
    else
        NSLog(@"Parsing failed: %@", [[parser parserError] localizedDescription]);
    
    [pool release];
    return 0;
    

    }

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 379k
  • Answers 379k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can't have the TreeMap itself sort on the values,… May 14, 2026 at 9:35 pm
  • Editorial Team
    Editorial Team added an answer Yes, it is correct. @Local interfaces are to be used… May 14, 2026 at 9:35 pm
  • Editorial Team
    Editorial Team added an answer "Command Line Tool" is listed under the Application section... May 14, 2026 at 9:35 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.