I am parsing XML returned from a website but sadly it is slightly malformed. I am getting XML like:
One option to resolve your issue is, as Jim Garrison suggested, providing custom EntityResolver. However, it will fix only the concrete issue you described. If your XML will be malformed by e.g. not closed tags, EntityResolver would not fix it. In such case I'd recommend to use one of available HTML "purifiers" in order to fix HTML syntax into XML-valid form. In my opinion the best available is this one: http://nekohtml.sourceforge.net/