开发者

NSXMLParser error 201 when it reaches xsi:nil

I have a NSXMLParser parsing and XML source and one of my tags is <expire xsi:nil="true"/>. When the parser reaches this tag, it throws an开发者_运维知识库 NSXMLParserErrorDomain error 201. If I remove this tag from my XML source, I get no error.

Any ideas why this is throwing an error??

Thanks!


Yes. The / in the end of this tag seems to be the issue. To close it properly, try

<expire xsi:nil="true">
</expire>


I got this error when I didn't add the URI for the namespace. So you should define in the root element the URI for your namespace like this:

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns:im="http://itunes.apple.com/rss" xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
  <entry>
    <im:name>Angry Birds Star Wars</im:name>
  </entry>
</feed>

Where "im" is the namespace like yours "xsi".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜