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

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?

Related

XML generation from data in core data iphone

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

iPhone: XML Parsing Problem?

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.

iPhone: xml parser for ajax

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

parse string with tags

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.

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.