XML error at ampersand (&)

后端 未结 5 1872
迷失自我
迷失自我 2020-11-29 07:29

I have a php file which prints an xml based on a MySql db.

I get an error every time at exactly the point where there is an & sign.

Here

5条回答
  •  独厮守ぢ
    2020-11-29 08:03

    You need to either turn & into its entity &, or wrap the contents in CDATA tags.

    If you choose the entity route, there are additional characters you need to turn into entities:

    >  >
    <  <
    '  '
    "  "
    

    Background: Beware of the ampersand when using XML

    Wikipedia: List of XML character entity references

提交回复
热议问题