Hi Dave,
Based on the error message itself, it indicate that the XML document you're
processing include some DTD declaration such as:
-=====================
<!DOCTYPE NEWSPAPER [
<!ELEMENT NEWSPAPER (ARTICLE+)>
<!ELEMENT ARTICLE (HEADLINE, BYLINE, LEAD, BODY, NOTES)>
........................
]>
======================
And for .NET 2.0 based XML processing(via Reader/Writer), we use
XmlReader/Writer abstract class to create the certain Reader/Writer
implemetation class. e.g.
============
XmlReaderSettings settings = new XmlReaderSettings();
XmlReader reader = XmlReader.Create("books.xml", settings);
============
#Creating XML Readers
http://msdn.microsoft.com/en-us/library/9khb6435.aspx
However, by default, the "XmlReaderSettings.ProhibitDtd" property is
"true", which means any DTD in XML document(loaded by reader created via
this setting) is not allowed.
As Martin suggested, you can turn off this property in the xmlReaderSetting
to create the XmlReader that can parse DTD awared XML document:
#XmlReaderSettings Class
http://msdn.microsoft.com/en-us/library/system.xml.xmlreadersettings.aspx
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
***@microsoft.com.
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Subject: For security reasons DTD is prohibited in this XML document.
Date: Thu, 29 Jan 2009 10:16:22 -0700
Hi;
One of our customers is getting the following error in our software.
This occurs in our code when we try to open and read it using the .NET
XML classes.
For security reasons DTD is prohibited in this XML document. To enable
DTD processing set the ProhibitD...
(Sorry, the rest of the rrror message is cut off in the screen shot
they sent us.)
What's going on here and what do we do to make this work?
thanks - dave
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com
Cubicle Wars - http://www.windwardreports.com/film.htm