Parsing XML in Objective-C - ios

I am creating an IOS app , I have to read the Rss feeds from the specified url and Display only the specified contents ti the user , how do i parse the XML contents ? Is there any similar API to JSoup present in Xcode ?

I would recommend to use the TBXMLParser: https://github.com/71squared/TBXML .
It's a light-weight XML parser designed for iOS.
However, you can check in http://www.raywenderlich.com/553/how-to-chose-the-best-xml-parser-for-your-iphone-project the different options you have depending on the type of document you're planning to parse.

Related

Can't get the F# Word typeprovider to work for custom Word documents

I've downloaded the FSharp 3 Sample Pack and tried out the sample for the Word documents typeprovider which works fine in the TestScript.fsx file when using the provided sample document (AA.docx). But when I try using it with a different Word document it doesn't work i.e. no properties are generated on the type provider instance (Person, MyCompany etc.). Even if I create a new document and copy the contents of AA.docx to it (keeping source formatting) it doesn't work. What could be the issue?
The word type provider uses the Open xML API. The same word content can have different XML representation at backend. I'd suggest you to download the Open XML SDK and use the tool to visualize its content.

Creating XML document using titanium

I am unable to find any examples or pre-defined XML methods to create XML document using titanium. Do any body have an example or methods to create XML document using Titanium [Appcelerator]. Any suggestions on this ?
Thanks
Ranjith
You might want to start your search with Titanium's documentation:
http://docs.appcelerator.com/titanium/latest/#!/guide/Working_with_XML_Data
Or with the whole namespace dedicated to manipulating XML, Titanium.XML:
http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.XML

How to read or parse .mobi file on iOS

I'm developing an iOS reader App and I want to support the .mobi file by Amazon.I search but find few things about parse .mobi file on iOS.Any help will be appreciated.
The Mobipocket e-book format is based on the Open eBook standard using XHTML and can include JavaScript and frames. It also supports native SQL queries to be used with embedded databases.
I am not aware of easily adaptable source code (especially for iOS), but here is the format spec, you could try to parse it, though I don't think it will be easy: http://wiki.mobileread.com/wiki/MOBI
It might not be elegant but maybe you can use a converter (there are a few links on the page) and try a more public/better supported format instead.

Custom file types with iOS Document Interaction Programming

I understand the basic of Document Interaction Programming and UIDocumentInteractionController and I've got it working in my app. However I'm having trouble with specific details of using custom file types. I can't find this addressed in the Apple docs anywhere.
My app uses it's own file types with unique extensions. The files themselves are just plists (xml), but I want the device to treat the files as only openable in my app. Originally I implemented the Document Interaction stuff to treat them as XML while I got it working, but now I want it to treat them as binary files that it needs to hand off to my app.
At the moment, if you have one of my files in an email attachment, iOS first shows the QuickLook (which just spews all the text content of the xml out) before you can choose to Open In. Similarly if one of my files is opened with Safari, Safari just shows the XML and doesn't give you the option to show it in my app at all.
So how do I get iOS to not treat my files as XML? I've changed the "Conforms to UTI" value and "public.mime-type" value in the info.plist, but it seems to have no effect.
Any tips greatly appreciated.
As far as i understand the UIT concept of Apple you cannot just change the file extension to change a potential UIT of the file. If the file contains XML-Data, other apps as well as internal apps might recognize your content and show it internally as XML.
Try to store your Plists with NSPropertyListSerialization NSPropertyListBinaryFormat_v1_0 (then you readble XML)
When you did that without success, why not trying this:
use zlib to compress the XML plists afterwards to a zipped file.
make a "unique" file extensions (<file>.myappname)
this should "hide" other apps and quick view.
Tell me if one of the ways did work for you.

XMl Data into String in blackberry

Read the contents of an local XML file in an application and get the whole contents of xml file into a string for blackberry application?
To create a string from a local file see this blackberry forum entry: Open txt file from mediacard
Assuming you want to use the data within the XML, I would recommend using a XML parser rather than string manipulation. The following links should get you going with XML parsers and explain some of the trade-offs:
Blackberry How To - Use the XML Parser
Parsing XML in J2ME
Add XML parsing to your J2ME applications
If, however, you have any say about the format used JSON might be a good alternative. JSON is easy for machines to parse (thus using fewer resources) and it's human readable.
I have found using a SAXParser and subclassing DefaultHandler has worked well. Allows to go element by element.

Resources