I want to export some html as valid XML.
https://jsfiddle.net/xpvt214o/617391/
<div id="test">
<p data-test=" ">
Foo bar
</p>
</div>
The output of $('#test').html() is: <p data-test=" "> Foo bar </p>. This is valid html. But the entity is not valid in XML. So a valid XML output would be <p data-test=" "> Foo bar </p>.
How can I create numerical entities/valid XML with $(...).html() ?
html()is intended to do is to be a wrapper around getting theinnerHTMLof an element..... you wouldn't?html()return valid xml, you should instead ask how to make valid xml.