|
|
#1 |
|
[iPhone] NSXMLParser problem
Hi all.
i am making us eof the NSXMLParser in my iPhone app. What i am facing now is that in my xml file i am having characters like <items> <item>my favourites</item> <item>BOOKS & DVDs</item> <item>itemNameTM products</item> </items> issue is that the foundCharacters method is returning me "BOOKS" , "&", "DVDs" in separately. Actually it should return :BOOKS & DVDs" as a single string, isnt it? the problem is there whereever i use "&", "trademark symbol" etc.... Its giving "my favourites" as a single string, means the problem is not because of whitespaces. I tried appending all the strings that i got using appendString method of NSString class. But the resulting string is displayed as "Books....." . Its not because of the space limitation, i think the string is appending some miscs... Please help me... I got stuck up with my application... |
|
|
|
0
|
|
|
#2 |
|
I don't think the & symbol is valid in an XML tag. I think you need to use:
& |
|
|
|
0
|
|
|
#3 |
|
Also, I think it's a good idea to not to rely on text to be contained in a single text node, ie you may need to concatenate sequential text nodes.
b e n |
|
|
|
0
|
|
|
#4 | |
|
Quote:
Yeah.. its actually '&' only when u open the file in DashCode, But in safari it will show as "&" only. So my question is why foundCharacters: method stops when some special chars get encoutered? ie... from <item>Books & DVDs</item> foundCharacters: method is returning "Books" , "&" , "DVDs" separately in 3 separate method calls. I am expecting entire string to get returned in a one call.... |
||
|
|
0
|
|
|
#5 | |
|
Quote:
Anyway, there are surely other, less obvious reasons the parser might break a text node value apart. It's an implementation detail that you can't predict. The behavior could also change in a future update. So you're stuck. Your code will have to handle the concatination itself. |
||
|
|
0
|
|
|
#6 |
|
this is how the parsers in java work as well. they don't always return one string and you have to concatenate the strings. using a stack to keep track of the element you are in will do the trick.
|
|
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| thread | Thread Starter | Forum | Replies | Last Post |
| iPhone 4 iOS 5 Proximity Sensor | g00degg | iOS 5 and earlier | 2 | Nov 2, 2011 08:16 PM |
| My apple ID had deauthorised on my iPhone 4 and iOS5?! | waywardsage | iOS 5 and earlier | 0 | Oct 12, 2011 07:22 PM |
| iPhone 4 RAM problem | Arcticguy | iPhone Tips, Help and Troubleshooting | 6 | Mar 19, 2011 01:04 PM |
| iPhone 3GS Major Problem =/ | marc.richards7 | iPhone Tips, Help and Troubleshooting | 1 | Mar 10, 2011 10:09 AM |
| Weird iPhone problem / screen | di6turbed | iPhone Tips, Help and Troubleshooting | 1 | Nov 13, 2010 06:06 PM |
All times are GMT -5. The time now is 07:20 AM.









Linear Mode

