Using the British pound sign in an XML feed to be read by an iPhone

前端 未结 4 801
梦如初夏
梦如初夏 2021-01-05 15:33

I have created a web-based UTF-8 XML feed for use in an iPhone application.

When viewing in a web browser, if the feed contains a British Pound sign, I get a nasty X

4条回答
  •  情话喂你
    2021-01-05 15:42

    if the feed contains a British Pound sign, I get a nasty XML error: XML Parsing Error: undefined entity

    Your feed probably is using entity £ as the pound character. £ is a HTML entity and those can't be used without declaring them with DTD associated with (or embedded in) your XML document. If the entity is not defined, the XML parser will report that it has found an unknown entity.

    Since you said your feed is encoded as UTF-8, you can just use the pound character as such - no need for an entity. Like LukeH suggested, other solution is to use the character reference £ which will be read as pound character by the XML parser.

提交回复
热议问题