What are invalid characters in XML

后端 未结 15 1281
时光说笑
时光说笑 2020-11-22 03:23

I am working with some XML that holds strings like:

This is a string

Some of the strings that I am passing to the

15条回答
  •  渐次进展
    2020-11-22 04:25

    The only illegal characters are &, < and > (as well as " or ' in attributes).

    They're escaped using XML entities, in this case you want & for &.

    Really, though, you should use a tool or library that writes XML for you and abstracts this kind of thing away for you so you don't have to worry about it.

提交回复
热议问题