iPhone: XML Parsing Problem? - iphone

I have some XML that looks like the following sample:
<INLINE>
<IMG LINKTEXT="خدمات ديني يقيني" NUMOFCOLOUMNS="9" NUMOFROWS="20">RamadanPortal</IMG>
</INLINE>
When I tried to parse the above XML using NSXMLParser, I'm getting the LINKTEXT response as U062e\U062f.
How can I get the exact Arabic text instead of Unicode characters? Thanks in advance.

You need to download the file in the correct encoding. There's plenty of documentation on this on the apple website (developer docs), but since you haven't supplied a code example I can't point you at the exact one.

Related

how to decode url for unicode font

I have been developing an asp application. I want to use response.charset that uses "UTF-8". I try to encode a unicode string by using server.urlencode. It is showed like this "%e3%81%a4%e3%82%". I got a problem this. I don't know how to decode url. Please, help me
This may help you, there is a tutorial and a tool that can decode the encoded URLs you can check it out here

Help to get rid of > < (html tags) in woot.com API?

so i am making a woot app, and i am using the API. in the description section of the xml rss file, there are always a lot of > and < (less than and greater than < >) surrounding the html tags. i realize they did this so as not to confuse them with the xml tags, but it is kind of annoying. i cant just put the code that i get from the xml file right into a webview, because it displays the less than and greater than signs, and does not actually do the tags. is there any way to get rid of this eaisily? or do i just have to make a loop that goes through all of the code, changing the </tr> to </tr>? i am just wondering how other people have gotten around this problem, or if there is some easy way to do it that i just dont know about. thanks
The content is encoded and you just need to decode it--once you do that it should just render like regular html. I would try to do that first before doing any kind of replace. I'm not an iphone developer but maybe this link can help.
The xml rss file that you are looking at has HTML encoded inside of XML. All you need to do is use an existing XML library for the iPhone such as NSXMLParser or GDataXML and you will not have to worry about decoding.

How parse html string in iphone

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.

iphone sdk - XML parseErrorOccurred: how to get rid of the illegal charaters when parsing in XML?

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?

iPhone "Web Site Error"

I'm writing server-side programs in PHP for an iPhone app. And I have no iPhone. :P
The iPhone app requests XML files from the site whenever a user runs the iPhone app. You may visit http://www.appvee.com/iphone/ads or http://www.appvee.com/iphone/latest for the XML files.
And a message box will show up with the following error messages:
"Web Site Error
Conversion of data failed. The file is not UTF-8, or in the encoding specified in XML header if XML.
"
Maybe I must add header("Content-type: text/xml"); at the beginning of the PHP files? I didn't add this line and it worked well before.
Any help is greatly appreciated.
I agree with ceejayoz, looks like this is a special characters issue.
I would suggest using the htmlentities method to encode the data in the xml file.
It might be the unescaped special character (looks like it's supposed to be a curly apostrophe) in the 'latest' XML. (in the line that goes "Find out information about what[THIS IS THE CHARACTER]s around you and how...")
Does adding an XML content type header resolve the issue? You ask it if's necessary but give no indication if it helps or not.