This documentation is archived and is not being maintained.

XmlWriter.WriteDocType Method

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

[Visual Basic]
Public MustOverride Sub WriteDocType( _
   ByVal name As String, _
   ByVal pubid As String, _
   ByVal sysid As String, _
   ByVal subset As String _
public abstract void WriteDocType(
 string name,
 string pubid,
 string sysid,
 string subset
public: virtual void WriteDocType(
 String* name,
 String* pubid,
 String* sysid,
 String* subset
) = 0;
public abstract function WriteDocType(
   name : String,
 pubid : String,
 sysid : String,
 subset : String


The name of the DOCTYPE. This must be non-empty.
If non-null it also writes PUBLIC "pubid" "sysid" where pubid and sysid are replaced with the value of the given arguments.
If pubid is a 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.
If non-null it writes [subset] where subset is replaced with the value of this argument.


Exception Type Condition
InvalidOperationException This method was called outside the prolog (after the root element).
ArgumentException The value for name would result in invalid XML.


This method does not check for invalid characters in pubid, sysid or subset.


See WriteDocType (in the XmlTextWriter class) for an example using this method.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

XmlWriter Class | XmlWriter Members | System.Xml Namespace