I use XPathDocument to parse an XML file, but if there's a doctype declaration, when I initializes a new instance of the XPathDocument class passing the path of the file, that contains the XML data, to its constructor, my application tries to connect to internet (probably to verify the correctness of the XML data) and remains blocked for a long period of time. This does not occur if I delete the doctype declaration from the XML file. XmlDocument.Load method has the same behavior. How can I fix this problem?
Thanks.
If you use the XPathDocument constructor that takes an XmlReader as its input, you can set an XmlResolver on the XmlReader. Then you can set the resolver to recognise the SVG doctype and supply a local copy of the SVG DTD.
Similarly, XmlDocument can also be given an XmlResolver before calling the Load method.