I see KissXML and Googles GData are both deprecated.
Can/should we still use them ?
What are the alternatives?
I want to be able to read and write xml with an XSD schema on iOS.
Any suggestions?
The gdata-objectivec-client project is not deprecated, though Google is generally using JSON for newer APIs.
The library's support for XML is wrapped up essentially in one class file, GDataXMLNode, which simulates Apple's tree-style NSXML API and builds on libxml2. While GDataXML is tailored to the needs of the library, it's usable outside of the library as well.
For your own app, it does not really matter if any particular XML library continues to be supported, so long as the library suits the needs of your app, and you have the source code to do any necessary maintenance.
I don't know if Google's GData is deprecated. As long as it parse XML correctly, I don't see why you can't/shouldn't use it. I'm using it.
Related
I'm trying to use the Swagger UI, and it says that I should begin by writing an api-doc that describes the exact api for a REST api. The problem is that I have no idea what this means. Is this document written in plain English? Or is there a certain format that will be able to generate the UI?
Thank you!
Swagger is a specification for describing REST APIs. Documentation of the specification can be found here - https://github.com/swagger-api/swagger-spec.
Generally, there are two ways to document your API. If you already have an existing API with code, you can use any of the existing libraries (https://github.com/swagger-api/swagger-spec#additional-libraries) to integrate into your code and generate documentation at run time. Some of those libraries also offer offline generation of such docs.
If you're looking to design an API, or would rather not integrate another library into your application, you can use https://github.com/swagger-api/swagger-editor either locally or with the online version - http://editor.swagger.io.
Once you have the documentation, you can use Swagger UI to visualize and test it.
previously i call the service from the same class when and where i need the data. is it a good approach to do it, let me know the best option to integrate web-services. Also using ASIHttpRequest framework is come under good coding standards?
yes ,ASIHttpRequest framework is come under good coding standards. there are some features that missing in AFNetwork.You can check below link
What major ASIHTTPRequest features is AFNetworking missing?
Yes, I agree ASIHttpRequest framework is good and most people prefer this but its not maintained so we need to looking for some other option also.I am using AFNetworking instead of ASIHttpRequest and found it is performance wise faster than ASIHttpRequest.It is already use NSSerialization for parsing the JSON string so you need not to worry about JSON parsing.They take care of every thing we required when we are call api like JSON parsing, XML parsing, loader etc.
You can check http://www.absoluteripple.com/1/post/2013/01/using-afnetworking.html
https://github.com/AFNetworking/AFNetworking/wiki/Getting-Started-with-AFNetworking
If a iphone app needs to communicate with a server, is xml the best route in most cases?
how hard is it to parse xml in obj-c?
It really depends on the type of data you wish to exchange, but XML will at the very least be able to handle any complexity of data structure you require. (If you only want to exchange a minimal amount of information, you might want to consider JSON that said.)
There are quite a few XML parsers available for Objective-C, most of which are discussed on this existing question: Navigating XML from Objective-C
Finally, there's a great blog post on Ray Wenderlich's web site that discusses the various XML parsers with a view to speed/memory footprint which might be important if you're parsing a large amount of data.
Depends on what is beeing transmitted.
That said I use JSON for 90% of my server to app communication. Easy to parse as libraries are readily available.
Nope. Not hard. But when it comes to APIs it seems many prefer JSON.
JSON is easier to work with than XML, regardless of parser used. Lots of server side people will understand JSON quite well because of the need to use it to work with Javascript.
The iPhone JSON parser I'd look at using first is YAJL.
I would either go with XML or JSON ( http://www.json.org/ ).
It's very easy to parse XML on the iPhone. There are quite a few XML parsers out there based on your preference. For a DOM parser you can use TBXML, otherwise Apple's built-in NSXMLParser does the job.
I use JSON, which is a great (and popular) solution for your server as well. Try out SBJSON for a good obj c library:
http://code.google.com/p/json-framework/
Is it correct, that there is no official API by Apple to create a well formed XML?
I searched the web for a while but I just found some external frameworks to create XML data structures.
I need it for a web service call and would prefer a native API by Apple.
Of course I could just put together some Strings, but I think that's not the best way to do.
There's libxml2, which is supported API on the iPhone. Nothing higher-level, but there are plenty of third-party wrappers.
I know how to connect to web server using an iPhone but now I have to connect the iPhone to a web service. I don't know how to do it and there is no demo or class available online.
Does anyone have any ideas?
You might find this tutorial, called Intro to SOAP Web Services useful. He shows how to package a request, send it to a web service, and read the response.
If you need some help with XML parsing, there is the TouchXML library which will give you a nice xml "document" to work with. Just be cautious of memory usage.
If you have to parse large XML message this tutorial about libxml and xmlreader in Cocoa will show you how to parse XML with the lower-level event-style parsers.
I've created an open source application for iPhone OS 3.0 that shows how to use REST & SOAP services in iPhone application, using XML (using 8 different iPhone libraries), SOAP, JSON (using SBJSON and TouchJSON), YAML, Protocol Buffers (Google serialization format) and even CSV from a PHP sample app (included in the project).
http://github.com/akosma/iPhoneWebServicesClient
The project is modular enough to support many other formats and libraries in the future.
The following presentation in SlideShare shows my findings in terms of performance, ease of implementation and payload characteristics:
http://www.slideshare.net/akosma/web-services-3439269
You can use these 2 lines which return the response of your HTTP request. You don't need any configuration. This code is usefull if you try to access a PHP scritp for example. After you just have to parse your result.
NSURL *URL=[[NSURL alloc] initWithString:stringForURL];
NSString *results = [[NSString alloc] initWithContentsOfURL :URL];
In my opinion, you have two options :
Use a third party library. You can try wsdl2objc. It didn't work for me, but it is under active development so it improves every day.
Use a raw HTTP connection and handle every request/response. This is the way I followed. It is hard, so I'd also like to know a better approach.