title: XML DocumentType method CreateDocumentType crashes if DTD is absent .NET C#
body: <p>I have a problem with generating an XML that needs to be generated automatically and then manually uploaded on a client site for validation.</p>
  
  <p>The specification of the client requires that we include the DTD declaration at the top.
  That is</p>
  
  <pre><code>&lt;!DOCTYPE TheFile System "TheDTD.dtd" ""&gt; 
  </code></pre>
  
  <p>So programmatically when I try to generate the XML the line </p>
  
  <pre><code>    XmlDocumentType doctype;
      doctype = doc.CreateDocumentType("TheFile", null, "TheDTD.dtd", null);
      doc.AppendChild(doctype);
  </code></pre>
  
  <p>Fails and it asks me the "TheDTD.dtd" should exist in the windows directory:
  C:\Windows\System32\inetsrv</p>
  
  <p>Later if I want to read the XmlDoc the line</p>
  
  <pre><code>        XmlDocument xmlDoc = new XmlDocument();
          xmlDoc.Load(xmlLocation);
  </code></pre>
  
  <p>Fails and it asks me the "TheDTD.dtd" should exist in the Project directory where the whole project is stored</p>
  
  <p>I don't want to actually validate the DTD, I just want to reference because the validation happens on the client side. Is there any way to add the line "  " in the XML without having to copy the actual .dtd in 2 different locations?</p>
  
  <p>If we make the declaration public and change this to   </p>
  
  <pre><code> &lt;!DOCTYPE TheFile PUBLIC "TheDTD.dtd" ""&gt; 
  </code></pre>
  
  <p>then everything works fine but the client requires that it should be SYSTEM and not PUBLIC.
  I wish the CreateDocumentType and the Load method wouldn't crash if the actual .dtd is missing because at this point I don't even have this file and it's not needed for my purposes.</p>
  
  <p>Thank you</p>