語言

XmlSchemaValidator.ValidateText 方法

定義

驗證目前項目內容中是否允許文字,並在目前專案具有簡單內容時累積文字以進行驗證。

多載

名稱 Description
ValidateText(String)

驗證指定文字 string 是否允許在當前元素上下文中使用,若當前元素內容簡單,則累積文本以供驗證。

ValidateText(XmlValueGetter)

驗證指定物件回傳 XmlValueGetter 的文字是否允許在當前元素上下文中使用,若當前元素內容簡單,則累積文本以供驗證。

ValidateText(String)

來源:
XmlSchemaValidator.cs
來源:
XmlSchemaValidator.cs
來源:
XmlSchemaValidator.cs
來源:
XmlSchemaValidator.cs
來源:
XmlSchemaValidator.cs

驗證指定文字 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)

來源:
XmlSchemaValidator.cs
來源:
XmlSchemaValidator.cs
來源:
XmlSchemaValidator.cs
來源:
XmlSchemaValidator.cs
來源:
XmlSchemaValidator.cs

驗證指定物件回傳 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)相容的通用語言執行時(CLR)型別。

例外狀況

目前元素上下文中不允許指定文字 string 。

該 ValidateText 方法未按正確順序呼叫。 例如, ValidateText 呼叫 方法 後會呼叫 ValidateAttribute。

文本 string 參數不可能是 null。

備註

以下是使用此 ValidateText 方法時需注意的重要事項。

  • 若元素內容簡單,則在每次呼叫string該方法時,指定的文字ValidateText會被串接,直到ValidateEndElement該方法被呼叫為止。 當呼叫該 ValidateEndElement 方法時,所有文字都會被驗證。

  • 若元素內容複雜,則不會發生文字串接。

另請參閱

適用於