title: Java XML DTD validation
body: <p>How can I validate an XML document against a DTD file which only my application knows about. So that the XML document which should be validated does not contain the DOCTYPE declaration which specifies the .dtd file. I need this in Java.
  Here is an example:
  The xml file to be validated:</p>
  
  <pre><code>&lt;?xml version = "1.0" ?&gt;
  &lt;Employee&gt;
    &lt;Emp_Id&gt; E-001 &lt;/Emp_Id&gt;
    &lt;Emp_Name&gt; Vinod &lt;/Emp_Name&gt;
    &lt;Emp_E-mail&gt; Vinod1@yahoo.com &lt;/Emp_E-mail&gt;
  &lt;/Employee&gt;
  </code></pre>
  
  <p>The .dtd file from my application:</p>
  
  <pre><code>&lt;!ELEMENT Employee (Emp_Id, Emp_Name, Emp_E-mail)&gt;
  &lt;!ELEMENT Emp_Id (#PCDATA)&gt;
  &lt;!ELEMENT Emp_Name (#PCDATA)&gt;
  &lt;!ELEMENT Emp_E-mail (#PCDATA)&gt;
  </code></pre>