Show unparsed XML in a HTML document using PHP

Last updated:

echo htmlspecialchars($xml_string,ENT_COMPAT);

According to the official website, ENT_XML1 should work too, but on my install (v5.3.5) it throws off a notice...

enclose the output with <pre> tags to see everything cleanly formatted.

Dialogue & Discussion