Java tutorial
//package com.java2s; import org.w3c.dom.*; public class Main { /**returns the type of document represented * @param d document to get the type of * @return string representing type of document*/ static public String getDocumentType(Document d) throws Exception { if (d == null) throw new Exception(); else return (d.getDoctype().getName()); } }