title: Validate xml against dtd from string
body: <p>I have an xml file that refers to a local dtd file. But the problem is that my files are being compressed into a single file (I am using Unity3D and it puts all my textfiles into one binary). This question is not Unity3D specific, it is useful for anyone that tries to load a DTD schema from a string.</p>
  
  <p>I have thought of a workaround to load the xml and load the dtd separately and then add the dtd file to the XmlSchemas of my document. Like so:</p>
  
  <pre><code>private void ReadConfig(string filePath)
  {
      // load the xml file
      TextAsset text = (TextAsset)Resources.Load(filePath);
      StringReader sr = new StringReader(text.text);
      sr.Read(); // skip BOM, Unity3D catch!
  
      // load the dtd file
      TextAsset dtdAsset = (TextAsset)Resources.Load("Configs/condigDtd");
  
      XmlSchemaSet schemaSet = new XmlSchemaSet();
      schemaSet.Add(...); // my dtd should be added into this schemaset somehow, but it's only a string and not a filepath.
  
      XmlReaderSettings settings = new XmlReaderSettings() { ValidationType = ValidationType.DTD, ProhibitDtd = false, Schemas = schemaSet};
      XmlReader r = XmlReader.Create(sr, settings);
  
      XmlDocument doc = new XmlDocument();
      doc.Load(r);
  }
  </code></pre>
  
  <p>The xml starts like this, but the dtd cannot be found. Not strange, because the xml file was loaded as a string, not from a file.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!DOCTYPE Scene SYSTEM "configDtd.dtd"&gt;
  </code></pre>