XmlWriter.WriteDocTypeAsync(String, String, String, String) XmlWriter.WriteDocTypeAsync(String, String, String, String) XmlWriter.WriteDocTypeAsync(String, String, String, String) XmlWriter.WriteDocTypeAsync(String, String, String, String) Method

定義

以非同步的方式寫入具有指定名稱與選擇性屬性的 DOCTYPE 宣告。Asynchronously writes the DOCTYPE declaration with the specified name and optional attributes.

public:
 virtual System::Threading::Tasks::Task ^ WriteDocTypeAsync(System::String ^ name, System::String ^ pubid, System::String ^ sysid, System::String ^ subset);
public virtual System.Threading.Tasks.Task WriteDocTypeAsync (string name, string pubid, string sysid, string subset);
abstract member WriteDocTypeAsync : string * string * string * string -> System.Threading.Tasks.Task
override this.WriteDocTypeAsync : string * string * string * string -> System.Threading.Tasks.Task
Public Overridable Function WriteDocTypeAsync (name As String, pubid As String, sysid As String, subset As String) As Task

參數

name
String String String String

DOCTYPE 名稱。The name of the DOCTYPE. 這必須不是空白的。This must be non-empty.

pubid
String String String String

如果為非 null,它也會寫入 PUBLIC "pubid" "sysid",其中 pubidsysid 會替換為指定之引數的值。If non-null it also writes PUBLIC "pubid" "sysid" where pubid and sysid are replaced with the value of the given arguments.

sysid
String String String String

如果 pubidnull,而 sysid 為非 null,則它會寫入 SYSTEM "sysid",其中 sysid 會由這個引數的值所取代。If pubid is null and sysid is non-null it writes SYSTEM "sysid" where sysid is replaced with the value of this argument.

subset
String String String String

如果非 Null,它會寫入 [subset],其中 subset 由這個引數的值來替代。If non-null it writes [subset] where subset is replaced with the value of this argument.

傳回

表示非同步 WriteDocType 作業的工作。The task that represents the asynchronous WriteDocType operation.

例外狀況

在先前的非同步作業完成前呼叫了 XmlWriter 方法。An XmlWriter method was called before a previous asynchronous operation finished. 在此情況下,會擲回 InvalidOperationException 與「非同步作業已經在進行中」的訊息。In this case, InvalidOperationException is thrown with the message "An asynchronous operation is already in progress."

-或--or-

在未將 Async 旗標設為 true的情況下呼叫了 XmlWriter 非同步方法。An XmlWriter asynchronous method was called without setting the Async flag to true. 在此情況下,就會擲回 InvalidOperationException 並顯示訊息「如果您要使用非同步方法,請將 XmlWriterSettings.Async 設為 true」。In this case, InvalidOperationException is thrown with the message "Set XmlWriterSettings.Async to true if you want to use Async Methods."

備註

這是具有相同功能的WriteDocType非同步版本。This is the asynchronous version of WriteDocType, with the same functionality. 若要使用這個方法,您必須將Async旗標true設定為。To use this method, you must set the Async flag to true.

適用於

另請參閱