Is it possible to insert HTML content in XML document?

前端 未结 4 1766
粉色の甜心
粉色の甜心 2020-12-02 09:48

I need to insert HTML content into an XML document, is this possible or should HTML content be, for example, encoded in BASE64 or with something else like that?

4条回答
  •  孤街浪徒
    2020-12-02 10:02

    so long as your html content doesn't need to contain a CDATA element, you can contain the HTML in a CDATA element, otherwise you'll have to escape the XML entities.

    your html here

    ]]>

    VS

    <p>your html here</p>
    

提交回复
热议问题