Aracılığıyla paylaş


XmlWriter.WriteDocType Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

When overridden in a derived class, writes the DOCTYPE declaration with the specified name and optional attributes.

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

Syntax

'Declaration
Public MustOverride Sub WriteDocType ( _
    name As String, _
    pubid As String, _
    sysid As String, _
    subset As String _
)
public abstract void WriteDocType(
    string name,
    string pubid,
    string sysid,
    string subset
)

Parameters

  • name
    Type: System.String
    The name of the DOCTYPE. This must be non-empty.
  • pubid
    Type: System.String
    If non-null it also writes PUBLIC "pubid" "sysid" where pubid and sysid are replaced with the value of the given arguments.
  • sysid
    Type: System.String
    If pubid is nulla null reference (Nothing in Visual Basic) and sysid is non-null it writes SYSTEM "sysid" where sysid is replaced with the value of this argument.
  • subset
    Type: System.String
    If non-null it writes [subset] where subset is replaced with the value of this argument.

Exceptions

Exception Condition
InvalidOperationException

This method was called outside the prolog (after the root element).

ArgumentException

The value for name would result in invalid XML.

XmlException

name is not valid.

NullReferenceException

The name, pubid, sysid, or subset parameter is nulla null reference (Nothing in Visual Basic).

Remarks

This method does not check for invalid characters in pubid, sysid or subset. It also does not check that the internal subset is well-formed.

Security noteSecurity Note:

The XmlWriter does not validate the data that is passed to the WriteDocType method. You should not pass arbitrary data to this method.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.