1

I'm parsing an XML file, everything is perfect and I'm seeing the file with NSLog, I'm seeing the result of the parsing also, but when I transfer the tag that I need to a NSMutableArray, the result is strange.

-(void) parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName

 namespaceURI:(NSString *)namespaceURI
    qualifiedName:(NSString *)qName {
    if ([elementName isEqualToString:@"nom"]) {
        // displays the Content of the tag
        NSLog(soapResults);
        // add the content of the tag to the NSMutableArray
        [mySuppliers addObject:soapResults];
        // displays the NSMutable Array
        NSLog(@"array: %@", mySuppliers);
        [soapResults setString:@""];
        elementFound = FALSE;
        // displays the count of the NSMutable Array
        NSLog(@"NUMBER %d", [mySuppliers count]);
 }
 ....

The output is:

2012-12-16 22:00:03.140 StartProj[11698:c07] ABC
2012-12-16 22:00:03.140 StartProj[11698:c07] array: (
    "ABC"
)
2012-12-16 22:00:03.140 StartProj[11698:c07] NUMBER 1
2012-12-16 22:00:03.141 StartProj[11698:c07] ABBOTT
2012-12-16 22:00:03.141 StartProj[11698:c07] array: (
    "ABBOTT ",
    "ABBOTT "
)
2012-12-16 22:00:03.141 StartProj[11698:c07] NUMBER 2
2012-12-16 22:00:03.142 StartProj[11698:c07] ACCESSORIES
2012-12-16 22:00:03.142 StartProj[11698:c07] array: (
    ACCESSORIES,
    ACCESSORIES,
    ACCESSORIES
)
2012-12-16 22:00:03.142 StartProj[11698:c07] NUMBER 3
2
  • Where you allocated the array. Commented Dec 17, 2012 at 4:42
  • do you get the solution ?? Commented Dec 17, 2012 at 7:13

2 Answers 2

1

For xml parsing try to use rapturexml which is very simple.

https://github.com/ZaBlanc/RaptureXML

Sign up to request clarification or add additional context in comments.

Comments

0

better can allocate NSmutabledictionary after add each and every element to dictinary finally dictionary items shift to nsmutable array. enter image description here

enter image description here

enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.