Hi,
I am trying to load an XMLdocument from a URL that returns XML with an embedded DTD directive that points to a folder on the external web site with a relative path. The XMLDom thinks this is a local path and says it can't find the file. I don't really care about the DTD and would happly ignore it if I could find a way to do this, or alternaitvely get the XMLDom to treat the dtd reference as a relative path on the server...I have also tried creating the xml reader with settings and configuring it to ignore processing instructions, prohibit DTD and offset the line number passed the DTD dfierctive - in all cases it still failed on the DTD. Any help will be much appreciated
Thanks in advance,
Brendon.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE TRANSACTIONS SYSTEM "..\dtd\transactions.dtd">
<TRANSACTIONS
...
<\TRANSACTIONS>
string
urlPattern = ConfigurationManager.AppSettings["TradesURLpattern"]; string urlString = string.Format(urlPattern, fund, day.ToString("MM/dd/yyyy"));//Set up the security credentials requieres to access the HTTP web sitestring urlUser = ConfigurationManager.AppSettings["TradesURLUser"];string urlPassword = ConfigurationManager.AppSettings["TradesURLPassword"];NetworkCredential credential = newNetworkCredential(urlUser, urlPassword);//Create xml stream reader from HTTP WebRequest req = WebRequest.Create(urlString);req.Credentials = credential;
WebResponse resp = req.GetResponse();System.IO.
StreamReader textReader = new System.IO.StreamReader(resp.GetResponseStream());XmlReaderSettings settings = newXmlReaderSettings();//settings.IgnoreProcessingInstructions = true;settings.ProhibitDtd =
true;//settings.LineNumberOffset = 3;
XmlReader xmlReader = XmlTextReader.Create(textReader,settings);XmlDocument xmlDoc = newXmlDocument();xmlDoc.Load(xmlReader);