Using “is less than” character (<) in a XML doc

2019-02-28 03:38发布

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条回答
兄弟一词,经得起流年.
2楼-- · 2019-02-28 04:29

You should replace < with &lt;

查看更多
登录 后发表回答