I'm getting an error message of:
HResult=-2146232000 Message=Cannot have multiple DTDs. Line 2, position 1. Source=System.Xml LineNumber=2
When I try to use my embedded DTD to validate an XML file.
I looked at Validate xml through the embedded resource DTD, and am using the same basic method, but it seems they don't get the same error I do.
I load the DTD add it to the parser context:
XmlParserContext parserContext = new XmlParserContext(nameTable, new XmlNamespaceManager(nameTable), "MyDocType", null, null, dtd, "file:///"+AppDomain.CurrentDomain.BaseDirectory.Replace('\\', '/'), null, XmlSpace.None);
And even set the base URI to match the searchpath given for the DTD when I don't include the context so that it might match the DTD referenced and the DTD provided in the context.
The XML contains:
<!DOCTYPE MyDocType SYSTEM "MyDocType.dtd">
What am I doing wrong here?
How can I get the DTD reference to match the one I have as my embedded resource?
Thanks!
-Baron