I need to test a XHTML code like <div> </div>
using XmlUnit. The Diff constructor tells me this:
org.xml.sax.SAXParseException: The entity "nbsp" was referenced, but not declared.
I know that nbsp entity is not defined in XML, but the HTML code is not mine, so I cannot replace it by #160 (that would be obvious solution otherwise).
I don't want to modify the HTML code by adding <!DOCTYPE html [ <!ENTITY nbsp " "> ]>
, I would prefer to leave the code without change.
Is there another way around this problem? I know there is a HTMLDocumentBuilder
class in XmlUnit, but I wasn't able to find good documentation or examples.