Using “is less than” character (<) in a XML document and parse it

*爱你&永不变心* 提交于 2019-12-02 09:01:20

问题


I need to parse a XML document in which there are conditions like the below example:

<element condition="var < 5">element name</element>

The problem is that the parser doesn't allow this 'is less than' (<) character.

I tried GDataXML -> it gives me an error saying there is an illegal character.

I also tried TBXML -> it doesn't take into account the attributes where there is this character.

I guess it's the same for other parsers.

How can I fix this?


回答1:


You should replace < with &lt;



来源:https://stackoverflow.com/questions/10683282/using-is-less-than-character-in-a-xml-document-and-parse-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!