nsxmlparser

iPhone: Parsing multiple XML with NSXMLParser in background disturbing each other

Deadly 提交于 2020-01-03 06:00:31
问题 I have a strange issue, when it comes to parsing XML with NSXMLParser on the iPhone. When starting the app, I want to preload 4 table-views, that are populated by RSS-Feeds in the background. When I init the table-views one-by-one, than loading, parsing and displaying all works like a charm. But when I try to init all view at once (at the same time), than it seems, that the XML-parser-instances are disturbing each other . Somehow data from one XML-Feed are "broadcasted" into other xml-parser

How to use NSXMLParser?

て烟熏妆下的殇ゞ 提交于 2020-01-03 02:56:06
问题 I have some XML which I need parsed in my Objective-C code. The XML is fairly simple. I have already searched Stackoverflow as well as Google but I did not find what I am looking for. Examples if how to use NSXMLParser would be useful, and if anyone has any suggestions on how to do this another way please let me know. 回答1: Did you look at the Apple sample applications? From the NSXMLParser class reference, I found no fewer than five sample projects that did parsing. GKTank KMLViewer

Encoding Line Feed Characters in the value of a NSXMLElement's attribute

十年热恋 提交于 2020-01-02 23:14:39
问题 The comment field of an XML database I'm reading and writing is stored as the attribute of an NSXMLElement. One entry contains a line feed (0x0a) character. These are encoded by a non NSXML encoder in the document I'm parsing as and get parsed correctly by NSXML. They result in the NSString containing the unicode value 0x0a 0x00 in memory (intel byte ordering). For example: <INFO BITRATE="192000" GENRE="Podcast" COMMENT="Test & More Test After the Line Feeds"</INFO> When writing this

XMLParser Advice

人走茶凉 提交于 2020-01-01 19:53:38
问题 I'm not sure what I am doing wrong. I have a URL leading to an XML tree that looks like: <result> ... <title> ... </title> <body> ... </body> ... </result> I just need to parse the file and get the title and body. Here is my object.h: #import <Foundation/Foundation.h> @interface Object : NSObject { NSString *title; NSString *description; } @property (nonatomic, retain) NSString *title; @property (nonatomic, retain) NSString *description; @end And here is Object.m: #import "Object.h"

How to set a delegate in a different class

那年仲夏 提交于 2020-01-01 09:58:27
问题 I'm working with NSXMLParser that parses a xml document. You have to set the delegate which we would be called every time the parser finds an element. The examples I've looked at all set the delegate to be the same class that's createing: NSXMLParser *parser = [[NSXMLParser alloc] initWithContentsOfURL:filename]; [parser setDelegate: self]; Other examples set the delegate to be the parent. What if I want another class (not related to the same class) to handle the delegate. What is the syntax

NSXMLParser Degelate Method 'parseErrorOccurred:' is Never Called on iOS 7

浪子不回头ぞ 提交于 2020-01-01 07:06:07
问题 I have been pulling out my hair for more than two days to fix this problem, and I was resisting so badly not to ask a question here since it might be someone else's problem before, but googling and reading all related questions on Stackoverflow like this, or this and reading more tutorials and testing different sample codes, I still haven't been able to figure this out. I had an RSS parser app that has been working pretty well since it was released on the store two years ago. It's a simple

Swift parsing attribute name for given elementName

一曲冷凌霜 提交于 2019-12-29 02:10:42
问题 Here is a part of my URL <cities> <country name="Абхазия"> <city id="37188" region="27028" head="" type="3" country="Абхазия" part="" resort="" climate="">Новый Афон</city> <city id="37178" region="10282" head="" type="3" country="Абхазия" part="" resort="" climate="">Пицунда</city> <city id="37187" region="37187" head="" type="3" country="Абхазия" part="" resort="" climate="">Гудаута</city> <city id="37172" region="10280" head="" type="3" country="Абхазия" part="" resort="" climate="">Гагра<

XMLParser.sharedParser.decode() in swift3

眉间皱痕 提交于 2019-12-25 08:31:09
问题 I used this code XMLParser.sharedParser.decode() in swift2. But I migrate swift3 this code didn't work. My code is here, func xmppStream(_ sender: XMPPStream!, didReceive message: XMPPMessage!) { let result1 = XMLParser.sharedParser.decode(String(message)) for (key, value) in result1 { let title = result1["title"] } if message.isChatMessage(){ sms = String(message.body()) if( sms == "" || message.body() == nil){ }else{ self.prefs.set(sms, forKey: "SMS") } } } 回答1: If you are using codes from

parse xml to NSMutableDictionary

匆匆过客 提交于 2019-12-25 08:19:46
问题 I am currently trying to parse some xml data into an NSDictionary . This is the first time I have tried something like this and am a little bit unsure of what I am doing, First off I am parsing some XML that looks roughly like this - <Rows> <Row ID="76" MANF="JARD" ISMANUF="F" ISSER="F"/> <Row ID="38" MANF ="SANBIN" ISMANUF ="F" ISSER ="T"/> <Rows> I am using the NSXMLParser delegates, so using a NSLog NSLog(@"attributes: %@", attributeDict); on parser:didStartElement:namespaceURI

Parsing SOAP response using NSXMLParser with Swift

荒凉一梦 提交于 2019-12-25 04:42:24
问题 I am trying to parse the Soap response (snippet shown below) using NSXMLParser. However when I print the Element names in the didStartElemnt delegate method I only get the following elements returned. Element's name is soap:Envelope Element's name is soap:Body Element's name is SearchResponse Element's name is SearchResult <?xml version="1.0" encoding="utf-8" standalone="no"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap