Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

how to enforce xml dtd validation in java

final String dtd = "/path/to/the/dtd_file.dtd"; 
builder.setEntityResolver(new EntityResolver() {
    public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
        if (systemId.endsWith("something.dtd")) {
            return new InputSource(new FileInputStream(dtd));
        }
        return null;
    }
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #enforce #xml #dtd #validation #java
ADD COMMENT
Topic
Name
8+1 =