I have a problem with generating an XML that needs to be generated automatically and then manually uploaded on a client site for validation.
The specification of the client requires that we include the DTD declaration at the top. That is
<!DOCTYPE TheFile System "TheDTD.dtd" "">
So programmatically when I try to generate the XML the line
XmlDocumentType doctype;
doctype = doc.CreateDocumentType("TheFile", null, "TheDTD.dtd", null);
doc.AppendChild(doctype);
Fails and it asks me the "TheDTD.dtd" should exist in the windows directory: C:\Windows\System32\inetsrv
Later if I want to read the XmlDoc the line
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(xmlLocation);
Fails and it asks me the "TheDTD.dtd" should exist in the Project directory where the whole project is stored
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?
If we make the declaration public and change this to
<!DOCTYPE TheFile PUBLIC "TheDTD.dtd" "">
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.
Thank you