I am creating a IOS phone directory app. I am trying to download a XML file from a url. This XML file will then be used to populate the directory app with phone numbers, names and identifications of all the people in the directory. I'm new to IOS development and I'm looking for any information or assistance on where to get started on how to parse the XML file.
What is included with Cocoa is NSXMLParser, and you can download the source code imageMap. There are also other third party libraries such as TouchXML and TBXML. Although in my experience TouchXML has some memory leaks issues that can create a lot of problems. And the one that has given me the fastest results is TBXML by far.
You can find a detailed article on all the available third-party parsers available here: Best xml parser for your app
TBXML is the way to go IMO. I have a complete code sample if you need it. If you post the structure of that XML file, I can modify the sample to fit your needs.
If you are creating the webserver manually, then I would look into using JSON instead of XML. It's a bit easier to work with. If you need to use XML, the NSXML parser class works pretty well. Here is a good tutorial: http://www.xcode-tutorials.com/parsing-xml-files/
Or you could check out chapter 21 I believe of the big nerd ranch iPhone programming book for a more detailed explination.
Good Luck!
Related
I want to generate an XML document in iOS. My primary goal is to generate it using inbuilt classes/libraries. I researched a lot and I found that NSXMLElement, NSXMLDocument etc are used to generate XML in OS X but not in iOS (correct me if I'm wrong about this). I found some of the third party libraries like GDataXML, APXML etc which generates the XMLDocument as per my needs. But, I'm trying hard to achieve the same using inbuilt classes (if any). BTW, I do not want the strings to be appended manually to create XML.
I'm not expecting a complete code which does the generation. Any help/suggestion on any inbuilt classes would be appreciated.
Thanks in advance.
You're right -- you need to look for a 3rd party solution for XML writing in iOS. For parsing, there is NSXMLParser.
I have created an iOS mobile application. Is there a way to generate a UML class diagram for the Swift programming language?
I have tried Omni Graffle, but it keeps saying that the project doesn't contain Objective-C interfaces. And Omni Graffle only does this for Objective-C.
I remember looking at this question a while ago and was disappointed that there wasn't any tool like this so I created one myself with the help of a colleague. It's free, it's open source, it's looking for contributors...
https://github.com/yoshimkd/swift-auto-diagram
And here's a tutorial on how to use it (don't worry it's very simple):
https://martinmitrevski.com/2016/10/12/swift-class-diagrams-and-more/
Happy diagraming :)
The answer unfortunately is: you can't do it. At least not automatically. Swift as compiler itself has enough flaws left. Leave alone some tool will be able to swallow any Swift code. Your only alternative is the good old manual way.
I know that Enterprise Architect has a possibility to define a language syntax based on BNF. But Swift is (again unfortunately) not context free. (In fact it's so context sensitive that it often swallows its own rear.) So that won't work either.
P.S.: Now that Swift is open source someone might take the opportunity to tap the compiler's output for the class interfaces. I guess that should not be too difficult, but it's a lot of work still.
Inspired by swift-auto-diagram and similar open-source tools I started to work on such utility with the goal to write it in Swift (to make contribution easier by Swift developers) and to integrate it in Xcode and the Swift ecosystem.
Xcode extension: https://github.com/MarcoEidinger/SwiftPlantUML-Xcode-Extension
You are able to generate a class diagram from selected lines of code or from a whole file displayed in Xcode. The class diagram will then be opened in your browser. There you can modify the diagram with PlantUML notation
To generate a class diagram from multiple source files you can use the underlying CLI tool and Swift Package: https://github.com/MarcoEidinger/SwiftPlantUML
There is a size limitation to the visible diagram content (but you can delete content in the browser with PlantUML notation)
Hello stackoverflow community..
Currently I'm developing a Crossplatform-App (android/iOS) which generates beside its other features pdf-files from user-content.
This works well with the help of jsPDF.
The output of this awesome library is an base64 encoded string of the binary PDF-File.
(see this issue of the creator about the 'binaryness' of pdf files under different circumstances on github).
Now my actual problem:
I need to save this base64 as a proper decoded binary file for further usage on different aspects of the system (mailing it, printing it, a.s.o.).
For Android there is a Plugin that does a similar thing with images. My current plan is to modify and publish it as a more generic plugin for saving base64 encoded to a file.
Problem is now, I cannot find a similar code for iOS, and since I have literally no experience in Objective-C (plenty of Java, ruby, javascript and c though), I'm not able to produce such a plugin in short time.
Do you guys know a plugin of this kind, which can be modified with little Objective-C knowledge.
Perhaps there is someone interested in developing this kind of plugin and we cut could a deal (the project I'm working on is commercial)
Hope to hear some interesting responses, because I'm running out of ideas here :D
Greetings
Jakob
Would anyone know a good and easy-to-use library on iOS to parse KML in order to get all the polygons described in the file?
This appears to be a promising one: https://github.com/mapbox/Simple-KML
Just researching myself.
You may find the KMLViewer example in the iOS sample code helpful: https://developer.apple.com/library/ios/#samplecode/KMLViewer/Introduction/Intro.html
This one seems to work well for me:
http://kmlframework.com/#license
The sample app lets you enter a URL to some KML, and it will display it.
It is free to use under the MIT license (which includes commercial use).
I am developing an app for iPad, and I need to modify several attributes in a XML file at runtime.
I found the class NSXMLDocument. But I haven't been able to import it to my project.
Is this class not available for iPhone/iPad development?
Is there some other approach I can consider?
I read about libxml library. Is it my answer or there is a better approach?
NSXMLDocument is MacOS X Cocoa only. You have available on iPhone NSXMLParser, and several external libraries built on libxml2 - TouchXML, KissXML and a couple of others.
Note that KissXML supports writing XML.
Other XML libraries that have been suggested include the XML support from Google Data and VTD-XML.
You are looking for a DOM XML parser, which is best for modification of XML documents. See for example this tutorial - without mapping to and from Model Objects - use the XPath.