XmlSchemaValidator.ValidateText 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
驗證目前項目內容中是否允許文字,並且累積文件以驗證目前項目是否有簡單內容。
多載
| 名稱 | Description |
|---|---|
| ValidateText(String) |
驗證在目前項目內容中是否允許指定的文字 |
| ValidateText(XmlValueGetter) |
驗證在目前項目內容中是否允許指定之 XmlValueGetter 物件傳回的文字,並在目前項目具有簡單內容的情況下,彙總文字以進行驗證。 |
ValidateText(String)
驗證在目前項目內容中是否允許指定的文字 string,並在目前項目具有簡單內容的情況下,彙總文字以進行驗證。
public:
void ValidateText(System::String ^ elementValue);
public void ValidateText(string elementValue);
member this.ValidateText : string -> unit
Public Sub ValidateText (elementValue As String)
參數
- elementValue
- String
目前項目內容中要驗證的文字 string。
例外狀況
在目前項目內容中不允許指定的文字 string。
未按正確的順序呼叫 ValidateText 方法。 例如,在呼叫 ValidateText 之後呼叫 ValidateAttribute 方法。
文字 string 參數不能為 null。
備註
以下是使用 ValidateText 方法時要考慮的重要注意事項。
如果專案具有簡單內容,則指定的文字
string會在每次呼叫 ValidateText 方法時串連,直到 ValidateEndElement 呼叫 方法為止。 ValidateEndElement呼叫 方法時,會驗證所有文字。如果元素具有複雜內容,則不會發生任何文字串連。
適用於
ValidateText(XmlValueGetter)
驗證在目前項目內容中是否允許指定之 XmlValueGetter 物件傳回的文字,並在目前項目具有簡單內容的情況下,彙總文字以進行驗證。
public:
void ValidateText(System::Xml::Schema::XmlValueGetter ^ elementValue);
public void ValidateText(System.Xml.Schema.XmlValueGetter elementValue);
member this.ValidateText : System.Xml.Schema.XmlValueGetter -> unit
Public Sub ValidateText (elementValue As XmlValueGetter)
參數
- elementValue
- XmlValueGetter
XmlValueGetter
delegate,用於將文字值當做與屬性之 XML 結構描述定義語言 (XSD) 類型相容的 Common Language Runtime (CLR) 類型進行傳遞。
例外狀況
在目前項目內容中不允許指定的文字 string。
未按正確的順序呼叫 ValidateText 方法。 例如,在呼叫 ValidateText 之後呼叫 ValidateAttribute 方法。
文字 string 參數不能為 null。
備註
以下是使用 ValidateText 方法時要考慮的重要注意事項。
如果專案具有簡單內容,則指定的文字
string會在每次呼叫 ValidateText 方法時串連,直到 ValidateEndElement 呼叫 方法為止。 ValidateEndElement呼叫 方法時,會驗證所有文字。如果元素具有複雜內容,則不會發生任何文字串連。