Note that there are some explanatory texts on larger screens.

plurals
  1. POAfter did finish loading i can't get my xml attribute Values in ios
    primarykey
    data
    text
    <p>Please help me out with this problem, I have struck last one week below this problem</p> <p>I get the XML response from the server in <code>connectionDidFinishLoading:</code>, I have called the method for the xml parsing method to get attribute values, but it won't call the parser method to get the values.</p> <p>This is the XML structure I am getting from the server, I tried to get the status attributes values in xml, but I can't accomplish that.</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;response action="registration"&gt; &lt;element&gt; &lt;properties name="username"&gt;test1@test.com&lt;/properties&gt; &lt;properties name="ticket"&gt;&lt;/properties&gt; &lt;properties name="chatNickName"&gt;test&lt;/properties&gt; &lt;properties name="vendorid"&gt;&lt;/properties&gt; &lt;properties name="currencyid"&gt;USD&lt;/properties&gt; &lt;properties name="status"&gt;0&lt;/properties&gt; &lt;properties name="errdesc"&gt;&lt;/properties&gt; &lt;/element&gt; &lt;/response&gt; -(void)callWs:(id)parentView:(NSString *)soapMessage { if ([parentView isKindOfClass:[ViewController class]]) { NSLog(@"wodObj"); viewobj = (ViewController *)parentView; } responseText = [[NSString alloc] init]; NSURL *url = [NSURL URLWithString:[WSAddress getWsAddress]]; NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url]; NSString *msgLength = [NSString stringWithFormat:@"%d", [soapMessage length]]; [theRequest addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"]; [theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"]; [theRequest setHTTPMethod:@"POST"]; [theRequest setHTTPBody: [soapMessage dataUsingEncoding:NSUTF8StringEncoding]]; NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; if( theConnection ) { receivedData = [NSMutableData data]; } else { NSLog(@"theConnection is NULL"); } } -(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { [receivedData setLength:0]; } -(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { [receivedData appendData:data]; } -(void)connection:(NSURLConnection *)connectiondidFailWithError:(NSError *)error { } - (void)connectionDidFinishLoading:(NSURLConnection *)connection { NSString *theXML = [[NSString alloc] initWithBytes: [receivedData mutableBytes] length:[receivedData length] encoding:NSUTF8StringEncoding]; NSLog(@"theXML ::%@",theXML); if (xmlParser) { //[xmlParser release]; } xmlParser = [[NSXMLParser alloc] initWithData:receivedData]; [xmlParser setDelegate:self]; [xmlParser setShouldResolveExternalEntities:YES]; [xmlParser parse]; if (viewobj != nil) { viewobj.wodTextview.text = self.responseText; NSLog(@"wod_meaning %@ ",wod_meaning); viewobj.Wod_meaning.text =self.wod_meaning; viewobj.linkurl =self.link; } } NSString *label; - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict{ if ([[attributeDict objectForKey: @"name"] isEqualToString: @"status"]) { NSLog(@"found category with name Local"); } if ([elementName isEqualToString:@"properties"]) { label = @"properties"; } } - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{ if ([label isEqualToString:@"name"]) { label = @""; self.responseText = @"\" "; self.responseText = [self.responseText stringByAppendingString:string]; self.responseText = [self.responseText stringByAppendingString:@" \""]; NSLog(@" self._wod %@", self.responseText); } if ([label isEqualToString:@"properties"]) { label = @""; self.responseText = @"\" "; self.responseText = [self.responseText stringByAppendingString:string]; self.responseText = [self.responseText stringByAppendingString:@" \""]; NSLog(@" self._wod %@", self.responseText); } } - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{ } </code></pre> <p>This is my code to connect to server and get response after that to parse delegate method to get attribute values</p>
    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.
 

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