I need to validate external XML document against DTD, that's stored in my jar. But the problem is, that this document probably don't have <!DOCTYPE
declaration. So, I can't just setEntityResolver.
I'm using SAXParserFactory, because this document might be very large. I have figured out how to do it with XSD - I simply create a new Schema and then set it to SAXParserFactory. But this approach don't work with DTD.
But I definitely need to do that with DTD, not XSD. Because DTD is pretty complex and it's not trivial to convert it to XSD.
So, is there a way?