Note that there are some explanatory texts on larger screens.

plurals
  1. POParse and Display XML from a HTTP POST response
    primarykey
    data
    text
    <p>This is a continuation of my previous question;</p> <p><a href="https://stackoverflow.com/questions/20511152/parse-display-xml-from-a-post-method">Parse/Display XML from a POST Method</a></p> <p>And it worked, but what the answer didnt say was how to display the parsed xml onto a button like what I want.</p> <p>I have a HTTP POST method that calls on the User's Lat &amp; Lon to get a response on what suburb their in, and it posts and recieves fine and I just display the XML response to a label to see if it works and it does but, I want to display the parsed XML on a button, in particular only one of the categories that the response gives.</p> <p>Here is my code</p> <pre><code>- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict { element = elementName; if ([element isEqualToString:@"geocode"]) { geocode = [[NSMutableDictionary alloc] init]; state = [[NSMutableString alloc] init]; suburb = [[NSMutableString alloc] init]; }} - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string { if ([element isEqualToString:@"state"]) { [state appendString:string]; } else if ([element isEqualToString:@"suburb"]) { [suburb appendString:string]; }} - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName { if ([elementName isEqualToString:@"geocode"]) { [geocode setObject:state forKey:@"state"]; [geocode setObject:suburb forKey:@"suburb"]; }} </code></pre> <p>And I use this part of the parser</p> <pre><code>parser = [[NSXMLParser alloc] initWithData:urlData]; [parser setDelegate:self]; [parser setShouldResolveExternalEntities:NO]; [parser parse]; </code></pre>
    singulars
    1. This table or related slice is empty.
    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. 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