DOMDocument appendXML with special characters

前端 未结 5 752
庸人自扰
庸人自扰 2020-12-07 05:25

I am retreiving some html strings from my database and I would like to parse these strings into my DOMDocument. The problem is, that the DOMDocument gives warnings at specia

5条回答
  •  无人及你
    2020-12-07 05:47

    I do see the problem in question, and also that the question has been answered, but if I may I'd like to suggest a thought from my past dealing with similar problems.

    It just might be so that your task requires including tagged data from the database in the resulting XML, but may or may not require parsing. If it's merely data for inclusion, and not structured parts of your XML, you can place strings from the database in CDATA section(s), effectively bypassing all validation errors at this stage.

提交回复
热议问题