Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok. I have solved this problem. This is how I got it to work.</p> <p>First I do is get the XML from the URL with special characters. Then I strip out all the special characters from the XML string. Then I convert the string to NSdata and then pass that nsdata object to my NSXMLParser. Since it has no more special characters NSXMLParser is happy. </p> <p>Here's the code for anyone who may run across in future. Big thank you to everyone who contributed to this post!</p> <pre><code>NSString *address = @"http://www.google.com/ig/api?weather=Paris"; NSURL *URL = [NSURL URLWithString:address]; NSError *error; NSString *XML = [NSString stringWithContentsOfURL:URL encoding:NSASCIIStringEncoding error:&amp;error]; //REMOVE ALL NON-ASCII CHARACTERS NSMutableString *asciiCharacters = [NSMutableString string]; for (NSInteger i = 32; i &lt; 127; i++) { [asciiCharacters appendFormat:@"%c", i]; } NSCharacterSet *nonAsciiCharacterSet = [[NSCharacterSet characterSetWithCharactersInString:asciiCharacters] invertedSet]; XML = [[XML componentsSeparatedByCharactersInSet:nonAsciiCharacterSet] componentsJoinedByString:@""]; NSData *data = [XML dataUsingEncoding:NSUTF8StringEncoding]; NSXMLParser *parser = [[NSXMLParser alloc] initWithData:data]; [parser setDelegate:self]; [parser parse]; </code></pre> <p><strong>EDIT:</strong></p> <p>NSXMLParser is a horrible tool. I have successfully used RaptureXML in all my apps. Its super easy to use and avoids all this non-sense of non-ascii characters. <a href="https://github.com/ZaBlanc/RaptureXML" rel="nofollow">https://github.com/ZaBlanc/RaptureXML</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload