Delete content in a XML file before parsing
I am parsing a XML file using NSXMLParser. And there is a certain section that is completely f*#@ed up and ends up breaking the parsing process. Basically its a bit of HTML that they n开发者_C百科ever wrapped in CDATA.
Is there anyway I can delete this before sending it through the parser so it doesn't break. (The information in this bit is not important and can be thrown away)
The XML kind of looks like this
<foo>
text</span></li><li>
<span class="ft">Not important:</span>
<span class="fc"><a href="Some random link">0</a>
</foo>
As you can see the span tags are all messed up. How can just get rid of foo's content completely.
You could run HTML tidy on the data first - this will give valid XML. You can add non html tags into the configuration file
精彩评论