I need to validate a multiple files produced by a third party against a DTD; The files don’t have dtd declaration and I can’t change this because I am not the owner,
Is there a way of validating them using dom4j by providing the DTD separately?
Thanks
You can always convert the DTD to a schema (using for example trang), and perform an in-memory validation against the schema for each document.
To do that, you would create one
javax.xml.validation.ValidationHandlerwith the converted schema, and feed it to a DOM4JSAXWriter.Another option is of course to
DocumentDefaultDocumentTypeto the parsed documentSAXReader