Just wondering if anyone has built an XML Parser for iOS?
It’s built in to iOS but not Xojo iOS and a huge pain to implement with declares since it is event driven. I hate to say it but maybe file a feature request? It’s not something I’ll be able to get to in the foreseeable future. You would have to implement NSXMLParser and the associated delegate plus a few supporting classes depending on your needs. See
Disregard. I was thinking JSON not XML.
Ok. a web view seems a bit over the top. Just parse and xml file.
Well, I should have considered the lack of an iOS XML parser before I got excited about porting my OS X app to iOS. I have huge XML formatted text files to parse. I suppose one could write RegEx code to parse the XML but that seems like a big task. I might look in to converting the XML file to JSON since the entire file is text.
There are two ways to read an XML file. By Document or Element By Element
On XOJO you can use both. On iOS (Note not XOJO iOS) only Element By Element and as Jason have said it’s really a pain to implement these declares to use this kind of parser in Xojo.
More over this kind of parser is rarely used on iOS itself since it’s practically only used to convert document to object and it’s much slower than a JSON doc to dictionary.
Old versions of iOS were without a native JSON parser, so some application used XML. When Apple made it available they showed how much was quicker and efficient.
So if you can use JSON.
If you can’t find a way to use JSON
I’ll get shot for saying this… but Xojo is by far NOT the only iOS developement environment
Do you know some iOS development environment with DOM access to XML docs?
If SWIFT or ObjC can’t do it, it can’t be done …
Note the article year: 2010
Nothing has changed, but now we have a native and pretty fast JSON <-> dictionary
Parse in useful only if you have big (really big) XML data to be converted to object or other internal structure.
If you have to navigate in your XML date you have to use the DOM approach.
The funny part is that the native web browser has the DOM reader, but it doesn’t expose these methods
It’s typical for Apple: on iOS the have a native PDF viewer, but if you need it you have to build by your self.