How To Parse A Website? - iphone

Hey I would like to build an app that could parse a website in order to get specific information. Specifically something that can parse http://www.fedex.com/Tracking?language=english&cntry_code=us&tracknumbers=681780934297262 for the important information. Is there a tutorial out there I could use.

This Cocoa With Love article discusses parsing XML and HTML with the libxml2 library that is available with Xcode, using XPath to pull out the node(s) of interest. Take a look at the PerformHTMLXPathQuery() function.

Try this tool: http://code.google.com/p/sitescraper/

Related

Parse data from image? [duplicate]

I am doing an app in which I require a business card reader I googled alot but BBY is the only solution which I was able to find out. Can anybody help me out with some opensource library which can be tweaked or used directly as a business card reader.
Please enlighten me on this.
you can look into the Tesseract open source engine... its pretty good for image processing.. i mean it will extract the text out of the image but then you will have to process it to extract name ,phone numbers and other details.
this guy has explained how to use it in iOS .. http://tinsuke.wordpress.com/2011/11/01/how-to-compile-and-use-tesseract-3-01-on-ios-sdk-5/
We started an open source project to build a Javascript library (based on the OCR engine tesseract.js for the OCR part) that exctract the relevant data from a business card based on heuristic criteria.
The library (BCR Library, available on github) is usable in any html project (included mobile cordova, phone gap or ionic projects) just including it via script tag.
The library doesn't have any external api call and fully works offline.
I think that you should give a try to Covve Bussiness Card Scan API. The quality of the result is great in various languages. You can check a comparison analysis of similar services here.
[Disclosure] I'm part of the team developing the service.

How to use NSXMLParser?

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.
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
LazyTableImages
SeismicXML (probably your best bet, and most directly related)
XMLPerformance
I recommend going through this tutorial by Ray Wenderlich:
http://www.raywenderlich.com/725/how-to-read-and-write-xml-documents-with-gdataxml
It uses GDataXML, which from my experience is a light-weight easy to use XML parser. It goes through all the basic steps to read and write to an XML document in a specific directory, including making or ammending to the file if it doesnt exist or exists respectively.

how to parse using xml parser in iphone?

Am able to parse
< name>Walmart< /name>
using xml parser
but how to parse
*< s:image link="http://i.walmartimages.com/i/p/00/02/72/42/77/0002724277837_500X500.jpg"/>*
using xml parse in iphone.
Thanks in advance
There are various ways of doing this. My personal favorite is using Xpath via TFHpple. Xpath is clearly documented and easy to understand at W3schools. Sorry, I can't link to it. Spam filter prevents it.
I've used this approach for all sorts of things, and it is also great to note that you can use this library with HTML data as well.
I got the solution......
No need to go to parser libraries...
We can parse such tags using NSXMLParser with the help of attribute concepts....
thanks for you all for helping me....
cheers

How to use regex to grab information from a web page?

I'd like to develop an iPhone application that get's it's data from a web pages using regex applied on that web page. I was wondering if that's possible by the SDK.
Thanks
Do NOT parse HTML using regular expressions.
Read this if you don't believe me :)
Yes it is. From my understanding RegexKit is widely used and it can be applied as a part of your project or as a static library.

XML with Cocoa Touch

I am a new learner at the area of Objective-C. I would like to retrieve data from XML page on the iPhone. Is it possible? It would be more helpful to me if I get an appropriate suggestion or code.
The SDK comes with the NSXMLParser class. Some people prefer to use the libxml2 library as it can be faster and more memory efficient than NSXMLDocument but you may want to wrap it with an Objective C layer as it is a C API. See this example.
There was a good episode of cocoaFusion: the other day that covered the ins and outs of XML parsing. Head on over to cocoafusion.net and look for Episode 2: An intro to using web APIs and XML.
The show notes section for that episode has some sample code downloads and links to other sites that contain more information (including some of the links mentioned in the other answers here).
Cheers!
A good article that lays out how you can use NSXMLParser to rip through xml.
Parsing XML in Cocoa
There is also some other libraries: TouchXML, KissXML.
Check out the SiesmicXML tute on Apple's iPhone developer site. It uses the XMLParser in a dedicated thread to parse XML in a backgroud process.
JK