Java tutorial
//package com.java2s; import org.w3c.dom.*; public class Main { public static boolean checkDocumentType(Document document, String dtdPublicId) { DocumentType documentType = document.getDoctype(); if (documentType != null) { String publicId = documentType.getPublicId(); return publicId != null && publicId.equals(dtdPublicId); } return true; // Workaround until DTDs are published // return false; } }