title: How to declare DOCTYPE and ENTITY in XML using StAX Parser in Java
body: <p>I am using StAX parser for generating XML. Here is what I need to generate:</p>
  
  <pre><code>&lt;?xml version = "1.0"?&gt;
  
  &lt;!DOCTYPE FILE PUBLIC "-//SOMETHING//DTD bla bla bla//EN" "scheme.dtd" 
      [
          &lt;!ENTITY file1 SYSTEM "D:\repo\file1.pdf" NDATA application_pdf&gt;
      ]
  &gt;
  
  &lt;FILES&gt;
      &lt;FILE&gt;
          &lt;METADATA&gt;&lt;/METADATA&gt;
          &lt;CONTENT&gt;&lt;/CONTENT&gt;
  ..... and so on .....
  </code></pre>
  
  <p>The problem is I don't know how to declare DOCTYPE and ENTITY tags. Tried to google it and didn't find any solutions. Please, help.</p>