Quantcast
Channel: Trying to parse non well-formed XML using NSXMLParser - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Answer by peterjb for Trying to parse non well-formed XML using NSXMLParser

$
0
0

To answer half your question, XML has 5 special characters that you may want to escape:

< -- replace with &lt;

> -- replace with &gt;

& -- replace with &amp;

' -- replace with &apos;

and

" -- replace with &quot;

Now, for the other half--how to find and replace these without also replacing all the tags, etc... Not easy, but I'd look in to regular expressions and NSRegularExpression: http://developer.apple.com/library/ios/#documentation/Foundation/Reference/NSRegularExpression_Class/Reference/Reference.html

Remember, depending on your use case, to escape the values of the parameters on tags, too; <tag parameter="with &quot;quotes&quot;" />


Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>