문제

I'm trying to parse an XML document using TouchXML for iOS. Normally this works great, but the current document I'm trying to parse contains angle brackets within the actual data. For example:

<reference>
<title>Title < 5</title>
</reference>

This fails due to an "invalid startTag" error. Is there anything I can do in TouchXML to get around this, or do I need to fix this in the source material?

도움이 되었습니까?

해결책

Not an ideal solution, but I ended up basically pre-processing the XML document before passing it to TouchXML. I used regular expressions to search for multiple angle brackets in a row (eg. <<, or <...<, or <...<...<), and replaced the additional ones with < or >. I then replaced these symbols with the original angle brackets when parsing the individual nodes for data.

There may be some way to tell TouchXML to ignore errors, but I couldn't find it.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top