I am receiving a chunk of data from PBX in string with tags included.
Something like this:
</response><rid>2</rid><name>2101<name><PeerList></PeerList><status>UNKNOWN</status>
cont...till it fetches all the names/users from the PBX.
what i need to do is to parse this string data to retrieve name & status and update in to the table where i can add the user into iPhone's phonebook.
I've started with NSScanner but eventually i messed up with that.
if anyone has any idea please help me out!!!!
You have received an XML file, use an XML parser first.
What language/OS/environment are you using?
NSScanner seems to be Mac specific.
Check out NSXMLParser or a third-party framework such as TouchXML.
Related
I am going to make an application and in that I want to store user's input in XML file and then parse it to another user,So I am confuse How can I do it, and which XML method should I use? NSXML parser,libxml,touchXML or KissXML?
I think this link will help you to choose best type of xml parser.
How To Choose The Best XML Parser for Your iPhone Project
Thank You
I want to create XML string to be sent to server through web-service. How do I do it natively in iPhone? Or do I have to use any third party library?
I was not able to download GDATA for iPhone. Any else available? Or any other way to do it?
Please help,
Thanks in advance.
You can create XML file with StringWithFormat method or Some of XML parser allow write XML as well. Please refer link of Parser for writing XML
http://www.raywenderlich.com/553/how-to-chose-the-best-xml-parser-for-your-iphone-project
You can use JSON parser also....
You may want to refer to SBJSON Framework which is frequently used for objective-C, I have used this framework in may of my iOS Apps.
You may get a reference about it from these links:
https://github.com/stig/json-framework
http://stig.github.com/json-framework/
Example Code: Also here is an example on, How to parse JSON with SBJSON Parser:
How to parse JSON into Objective C - SBJSON
http://jasarien.com/?p=428
I'm developing an app for iPhone. I'm trying to parse an xml made with ajax, with a tag named response. The parser I've been using is TBXML, which performs pretty ok with any XML, but the ones made with ajax!
Is there another parser that can do this?
What do you mean for "xml made with ajax". the response should be the same. Or maybe do you get a json response? In that case you could use TouchJSON
i m using php file for using data in my application,
in this file i post data on the server and if i get the data from the server
then it is in html formate.
so problem is that i have a string with html tags how i use data in that string.
how i extract data from html string.
Use NSXMLParser class. it works for HTML too. There are three useful delegate methods.
If your HTML out put is some simple data - may be you can write some simple NSString parser your self like 'markhunte' mentioned, if you have large complex data in HTML then you have to go for some open source parsers.
Cocoa does not provide HTML parser, Forum discussion claims in some case XML parser itself work for you, but I never go it working for my data.
In my case I had very simple TAG which I had handled using my own parser using NSString.
I have used the code from --> Flatten-html-content-ie-strip-tags-cocoaobjective-c.
There are also examples of its use on SO.
Just use NSScanner, it is great for searching in between tags that are permanent. If you post some page code I help you set up the scanner.
When pasrsing XML using NSXMLParser, I encountered this problem when the parser received some characters that it couldn't take such as: the auto-correct "..." or "--" in MSWord.
My app reads XML which is exported out of my database from a PHP file. I wonder if I should handle this on the server side or on the iPhone SDK and How?
any help would be appreciated.
It sounds like an encoding issue.
Are you sure that the XML file is being served as the same encoding as in its header?