473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

XmlTextReader not able to find DTD file

I'm having trouble with an ASP.NET application used to receive XML content
over http. The application gets the XML content as the HttpWebRequest
content, and the XML document references a DTD file for XML validation. I
have the DTD file in the Bin folder, but that's not where .NET expects it to
be.

When debuggin, I found that the path where .NET was looking for the DTD
file, was the path of the IIS process (C:\Windows\System32\inetsrv\), so I
copied the DTD file to that folder, and everything seemed to work just fine.
And it did so in the production environment too, until it started to look
for the DTD file from some folder beneath the ftproot folder! I suppose it's
the last (current) folder used by IIS for some FTP session.

I guess I need a way to explicitly tell where the DTD file is. The exception
occures when i call the Load() method of an XmlDocument object. Can someone
help me out with this?

BTW, the XML content looks like this:

<?xml version="1.0" encoding="ISO-8859-1"?<!DOCTYPE MSGLST SYSTEM
"pswincom_report_request.dtd">
<MSGLST><MSG><ID>1</ID><REF>98183520</REF><RCV>4793213244</RCV><STATE>DELIVRD</STATE></MSG></MSGLST>

Jul 23 '08 #1
1 1844
Eivind Gussiås Løkseth wrote:
I guess I need a way to explicitly tell where the DTD file is. The
exception occures when i call the Load() method of an XmlDocument
object. Can someone help me out with this?

BTW, the XML content looks like this:

<?xml version="1.0" encoding="ISO-8859-1"?<!DOCTYPE MSGLST SYSTEM
"pswincom_report_request.dtd">
<MSGLST><MSG><ID>1</ID><REF>98183520</REF><RCV>4793213244</RCV><STATE>DELIVRD</STATE></MSG></MSGLST>
You can set a custom XmlResolver:
http://msdn.microsoft.com/en-us/libr...lresolver.aspx
One way to do that is to subclass XmlUrlResolver where the subclass
overrides the GetEntity and ResolveUri methods and makes sure that for
the URI pswincom_report_request.dtd the DTD is loaded from the location
where you stored it.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Jul 23 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Hugh McFadden | last post by:
Are there any work arounds to get XmlTextReader to work with files bigger than 2GB? I tried to get the source of XmlTextReader and create a version with long (instead of int) offsets but I can't...
5
by: Chris | last post by:
Hi, the docs say : "The Xml-document is not loaded into memory when using XmlTextReader, as opposed to using the DOM where the entire document is loaded in memory" but, when using...
2
by: ecomputerdelicacy | last post by:
Compact Framework SP3 (and I think also SP2 and SP1) XmlTextReader does not handle !DOCTYPE and (maybe?) rdf elements. How can I get the XmlTextReader to read these without issuing a...
3
by: MFRASER | last post by:
I am trying to import some data into my objects and I have been using XMLDoc.LoadXML(file), but someone told me that this is very memory intensive that if I am reading a text file that I would be...
6
by: Tim Barg | last post by:
I am using a CryptoStream to encrypt and then save an xml file. However, when reading it back in, I am getting a CryptographicException. I am hitting this because I have some large xml files ( >...
4
by: Paul Bromley | last post by:
I thought that XMLTextReader would be simple to use, but I have run into problems with it! I seem to have great difficulty extrcting the text of specific elements from a very simple XML file. I...
1
by: Dica | last post by:
hi all first off, i'm not trying to cross post, but couldn't find this newsgroup earlier (got here from a recommendation on microsoft.public.vb, where i originally posted this question). ...
2
by: Michael | last post by:
Hi All, I have something going wrong with the XmlTextReader. I have a function that reads the following XML example. For some reason the code is only getting two of the 3 Values elements. Here is...
4
by: CodeRazor | last post by:
I am reading an xml file from a URL. I was originally doing this using the XmlDocument class. But this was very slow. The XmlTextReader is meant to be much quicker for forward only retrieval of...
2
by: bbindae | last post by:
I am trying to check whether XmlTextReader reads the xml file successfully or not. MSDN says that XmlTextReader raise the FileNotFoundException when it cannot find the file to read. Here is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.