XmlReaderSettings.ProhibitDtd Property

 
Note: This API is now obsolete.

Gets or sets a value indicating whether to prohibit document type definition (DTD) processing. This property is obsolete. Use DtdProcessing instead.

Namespace:   System.Xml
Assembly:  System.Xml (in System.Xml.dll)

[<ObsoleteAttribute("Use XmlReaderSettings.DtdProcessing property instead.")>]
member ProhibitDtd : bool with get, set

Property Value

Type: System.Boolean

true to prohibit DTD processing; otherwise false. The default is true.

When set to true, the XmlReader throws an XmlException when any DTD content is encountered. Do not enable DTD processing if you are concerned about Denial of Service issues or if you are dealing with untrusted sources.

If you have DTD processing enabled, you can use the XmlSecureResolver to restrict the resources that the XmlReader can access. You can also design your application so that the XML processing is memory and time constrained. For example, configure time-out limits in your ASP.NET application.

This property is obsolete. Use DtdProcessing instead. If you had set ProhibitDtd to its default value true set DtdProcessing to Prohibit. If you had set ProhibitDtd to false set DtdProcessing to Parse.

The following example validates data using a DTD.

No code example is currently available or this language may not be supported.

The example uses the itemDTD.xml file as input.

<!--XML file using a DTD-->
<!DOCTYPE store [
  <!ELEMENT store (item)*> 
  <!ELEMENT item (name,dept,price)>
  <!ATTLIST item type CDATA #REQUIRED>
  <!ELEMENT name (#PCDATA)>
  <!ELEMENT price (#PCDATA)>]>
<store>
  <item type="supplies"  ISBN="2-3631-4">
    <name>paint</name>
    <price>16.95</price>
  </item>
</store>

.NET Framework
Available since 2.0
Return to top
Show: