XmlSchemaValidator XmlSchemaValidator XmlSchemaValidator XmlSchemaValidator Class

定義

XML スキーマ定義言語 (XSD: XML Schema Definition Language) スキーマ検証エンジンを表します。Represents an XML Schema Definition Language (XSD) Schema validation engine. XmlSchemaValidator クラスは継承できません。The XmlSchemaValidator class cannot be inherited.

public ref class XmlSchemaValidator sealed
public sealed class XmlSchemaValidator
type XmlSchemaValidator = class
Public NotInheritable Class XmlSchemaValidator
継承
XmlSchemaValidatorXmlSchemaValidatorXmlSchemaValidatorXmlSchemaValidator

次の例では、検証、contosoBooks.xmlファイルに対して、contosoBooks.xsdスキーマ。The following example validates the contosoBooks.xml file against the contosoBooks.xsd schema. この例では、XmlSerializer クラスを使用して、contosoBooks.xml ファイルを逆シリアル化し、ノードの値を XmlSchemaValidator クラスのメソッドに渡します。The example uses the XmlSerializer class to deserialize the contosoBooks.xml file and pass the value of the nodes to the methods of the XmlSchemaValidator class.

using System;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
using System.Collections;

namespace Microsoft.Samples.Xml.Schema
{
    class XmlSchemaValidatorExamples
    {
        static void Main()
        {
            // The XML document to deserialize into the XmlSerializer object.
            XmlReader reader = XmlReader.Create("contosoBooks.xml");

            // The XmlSerializer object.
            XmlSerializer serializer = new XmlSerializer(typeof(ContosoBooks));
            ContosoBooks books = (ContosoBooks)serializer.Deserialize(reader);

            // The XmlSchemaSet object containing the schema used to validate the XML document.
            XmlSchemaSet schemaSet = new XmlSchemaSet();
            schemaSet.Add("http://www.contoso.com/books", "contosoBooks.xsd");

            // The XmlNamespaceManager object used to handle namespaces.
            XmlNamespaceManager manager = new XmlNamespaceManager(reader.NameTable);

            // Assign a ValidationEventHandler to handle schema validation warnings and errors.
            XmlSchemaValidator validator = new XmlSchemaValidator(reader.NameTable, schemaSet, manager, XmlSchemaValidationFlags.None);
            validator.ValidationEventHandler += new ValidationEventHandler(SchemaValidationEventHandler);

            // Initialize the XmlSchemaValidator object.
            validator.Initialize();

            // Validate the bookstore element, verify that all required attributes are present
            // and prepare to validate child content.
            validator.ValidateElement("bookstore", "http://www.contoso.com/books", null);
            validator.GetUnspecifiedDefaultAttributes(new ArrayList());
            validator.ValidateEndOfAttributes(null);

            // Get the next exptected element in the bookstore context.
            XmlSchemaParticle[] particles = validator.GetExpectedParticles();
            XmlSchemaElement nextElement = particles[0] as XmlSchemaElement;
            Console.WriteLine("Expected Element: '{0}'", nextElement.Name);

            foreach (BookType book in books.Book)
            {
                // Validate the book element.
                validator.ValidateElement("book", "http://www.contoso.com/books", null);

                // Get the exptected attributes for the book element.
                Console.Write("\nExpected attributes: ");
                XmlSchemaAttribute[] attributes = validator.GetExpectedAttributes();
                foreach (XmlSchemaAttribute attribute in attributes)
                {
                    Console.Write("'{0}' ", attribute.Name);
                }
                Console.WriteLine();

                // Validate the genre attribute and display its post schema validation information.
                if (book.Genre != null)
                {
                    validator.ValidateAttribute("genre", "", book.Genre, schemaInfo);
                }
                DisplaySchemaInfo();

                // Validate the publicationdate attribute and display its post schema validation information.
                if (book.PublicationDate != null)
                {
                    validator.ValidateAttribute("publicationdate", "", dateTimeGetter(book.PublicationDate), schemaInfo);
                }
                DisplaySchemaInfo();

                // Validate the ISBN attribute and display its post schema validation information.
                if (book.Isbn != null)
                {
                    validator.ValidateAttribute("ISBN", "", book.Isbn, schemaInfo);
                }
                DisplaySchemaInfo();

                // After validating all the attributes for the current element with ValidateAttribute method,
                // you must call GetUnspecifiedDefaultAttributes to validate the default attributes.
                validator.GetUnspecifiedDefaultAttributes(new ArrayList());

                // Verify that all required attributes of the book element are present
                // and prepare to validate child content.
                validator.ValidateEndOfAttributes(null);

                // Validate the title element and its content.
                validator.ValidateElement("title", "http://www.contoso.com/books", null);
                validator.ValidateEndElement(null, book.Title);

                // Validate the author element, verify that all required attributes are present
                // and prepare to validate child content.
                validator.ValidateElement("author", "http://www.contoso.com/books", null);
                validator.GetUnspecifiedDefaultAttributes(new ArrayList());
                validator.ValidateEndOfAttributes(null);

                if (book.Author.Name != null)
                {
                    // Validate the name element and its content.
                    validator.ValidateElement("name", "http://www.contoso.com/books", null);
                    validator.ValidateEndElement(null, book.Author.Name);
                }

                if (book.Author.FirstName != null)
                {
                    // Validate the first-name element and its content.
                    validator.ValidateElement("first-name", "http://www.contoso.com/books", null);
                    validator.ValidateEndElement(null, book.Author.FirstName);

                }

                if (book.Author.LastName != null)
                {
                    // Validate the last-name element and its content.
                    validator.ValidateElement("last-name", "http://www.contoso.com/books", null);
                    validator.ValidateEndElement(null, book.Author.LastName);
                }

                // Validate the content of the author element.
                validator.ValidateEndElement(null);

                // Validate the price element and its content.
                validator.ValidateElement("price", "http://www.contoso.com/books", null);
                validator.ValidateEndElement(null, book.Price);

                // Validate the content of the book element.
                validator.ValidateEndElement(null);
            }

            // Validate the content of the bookstore element.
            validator.ValidateEndElement(null);

            // Close the XmlReader object.
            reader.Close();
        }

        static XmlSchemaInfo schemaInfo = new XmlSchemaInfo();
        static object dateTimeGetterContent;

        static object dateTimeGetterHandle()
        {
            return dateTimeGetterContent;
        }

        static XmlValueGetter dateTimeGetter(DateTime dateTime)
        {
            dateTimeGetterContent = dateTime;
            return new XmlValueGetter(dateTimeGetterHandle);
        }

        static void DisplaySchemaInfo()
        {
            if (schemaInfo.SchemaElement != null)
            {
                Console.WriteLine("Element '{0}' with type '{1}' is '{2}'",
                    schemaInfo.SchemaElement.Name, schemaInfo.SchemaType, schemaInfo.Validity);
            }
            else if (schemaInfo.SchemaAttribute != null)
            {
                Console.WriteLine("Attribute '{0}' with type '{1}' is '{2}'",
                    schemaInfo.SchemaAttribute.Name, schemaInfo.SchemaType, schemaInfo.Validity);
            }
        }

        static void SchemaValidationEventHandler(object sender, ValidationEventArgs e)
        {
            switch (e.Severity)
            {
                case XmlSeverityType.Error:
                    Console.WriteLine("\nError: {0}", e.Message);
                    break;
                case XmlSeverityType.Warning:
                    Console.WriteLine("\nWarning: {0}", e.Message);
                    break;
            }
        }
    }

    [XmlRootAttribute("bookstore", Namespace = "http://www.contoso.com/books", IsNullable = false)]
    public class ContosoBooks
    {
        [XmlElementAttribute("book")]
        public BookType[] Book;
    }

    public class BookType
    {
        [XmlAttributeAttribute("genre")]
        public string Genre;

        [XmlAttributeAttribute("publicationdate", DataType = "date")]
        public DateTime PublicationDate;

        [XmlAttributeAttribute("ISBN")]
        public string Isbn;

        [XmlElementAttribute("title")]
        public string Title;

        [XmlElementAttribute("author")]
        public BookAuthor Author;

        [XmlElementAttribute("price")]
        public Decimal Price;
    }

    public class BookAuthor
    {
        [XmlElementAttribute("name")]
        public string Name;

        [XmlElementAttribute("first-name")]
        public string FirstName;

        [XmlElementAttribute("last-name")]
        public string LastName;
    }
}
Imports System
Imports System.Xml
Imports System.Xml.Schema
Imports System.Xml.Serialization
Imports System.Collections


Namespace Microsoft.Samples.Xml.Schema

    Class XmlSchemaValidatorExamples

        Shared Sub Main()

            ' The XML document to deserialize into the XmlSerializer object.
            Dim reader As XmlReader = XmlReader.Create("contosoBooks.xml")

            ' The XmlSerializer object.
            Dim serializer As XmlSerializer = New XmlSerializer(GetType(ContosoBooks))
            Dim books As ContosoBooks = CType(serializer.Deserialize(reader), ContosoBooks)

            ' The XmlSchemaSet object containing the schema used to validate the XML document.
            Dim schemaSet As XmlSchemaSet = New XmlSchemaSet()
            schemaSet.Add("http://www.contoso.com/books", "contosoBooks.xsd")

            ' The XmlNamespaceManager object used to handle namespaces.
            Dim manager As XmlNamespaceManager = New XmlNamespaceManager(reader.NameTable)

            ' Assign a ValidationEventHandler to handle schema validation warnings and errors.
            Dim validator As XmlSchemaValidator = New XmlSchemaValidator(reader.NameTable, schemaSet, manager, XmlSchemaValidationFlags.None)
            'validator.ValidationEventHandler += New ValidationEventHandler(SchemaValidationEventHandler)
            AddHandler validator.ValidationEventHandler, AddressOf SchemaValidationEventHandler

            ' Initialize the XmlSchemaValidator object.
            validator.Initialize()

            ' Validate the bookstore element, verify that all required attributes are present
            ' and prepare to validate child content.
            validator.ValidateElement("bookstore", "http://www.contoso.com/books", Nothing)

            validator.GetUnspecifiedDefaultAttributes(New ArrayList())
            validator.ValidateEndOfAttributes(Nothing)

            ' Get the next exptected element in the bookstore context.
            Dim particles() As XmlSchemaParticle = validator.GetExpectedParticles()
            Dim nextElement As XmlSchemaElement = particles(0)
            Console.WriteLine("Expected Element: '{0}'", nextElement.Name)

            For Each book As BookType In books.book
                ' Validate the book element.
                validator.ValidateElement("book", "http://www.contoso.com/books", Nothing)

                ' Get the exptected attributes for the book element.
                Console.Write(vbCrLf & "Expected attributes: ")
                Dim attributes() As XmlSchemaAttribute = validator.GetExpectedAttributes()
                For Each attribute As XmlSchemaAttribute In attributes
                    Console.Write("'{0}' ", attribute.Name)
                Next
                Console.WriteLine()

                ' Validate the genre attribute and display its post schema validation information.
                If Not book.Genre Is Nothing Then
                    validator.ValidateAttribute("genre", "", book.Genre, schemaInfo)
                End If
                DisplaySchemaInfo()

                ' Validate the publicationdate attribute and display its post schema validation information.
                If Not book.PublicationDate = Nothing Then
                    validator.ValidateAttribute("publicationdate", "", dateTimeGetter(book.PublicationDate), schemaInfo)
                End If
                DisplaySchemaInfo()

                ' Validate the ISBN attribute and display its post schema validation information.
                If Not book.Isbn Is Nothing Then
                    validator.ValidateAttribute("ISBN", "", book.Isbn, schemaInfo)
                End If
                DisplaySchemaInfo()
    
                ' After validating all the attributes for the current element with ValidateAttribute method,
                ' you must call GetUnspecifiedDefaultAttributes to validate the default attributes.
                validator.GetUnspecifiedDefaultAttributes(New ArrayList())

                ' Verify that all required attributes of the book element are present
                ' and prepare to validate child content.
                validator.ValidateEndOfAttributes(Nothing)

                ' Validate the title element and its content.
                validator.ValidateElement("title", "http://www.contoso.com/books", Nothing)
                validator.ValidateEndElement(Nothing, book.Title)

                ' Validate the author element, verify that all required attributes are present
                ' and prepare to validate child content.
                validator.ValidateElement("author", "http://www.contoso.com/books", Nothing)

                validator.GetUnspecifiedDefaultAttributes(New ArrayList())
                validator.ValidateEndOfAttributes(Nothing)

                If Not book.Author.Name Is Nothing Then
                    ' Validate the name element and its content.
                    validator.ValidateElement("name", "http://www.contoso.com/books", Nothing)
                    validator.ValidateEndElement(Nothing, book.Author.Name)
                End If

                If Not book.Author.FirstName Is Nothing Then
                    ' Validate the first-name element and its content.
                    validator.ValidateElement("first-name", "http://www.contoso.com/books", Nothing)
                    validator.ValidateEndElement(Nothing, book.Author.FirstName)

                End If

                If Not book.Author.LastName Is Nothing Then
                    ' Validate the last-name element and its content.
                    validator.ValidateElement("last-name", "http://www.contoso.com/books", Nothing)
                    validator.ValidateEndElement(Nothing, book.Author.LastName)
                End If

                ' Validate the content of the author element.
                validator.ValidateEndElement(Nothing)

                ' Validate the price element and its content.
                validator.ValidateElement("price", "http://www.contoso.com/books", Nothing)
                validator.ValidateEndElement(Nothing, book.Price)

                ' Validate the content of the book element.
                validator.ValidateEndElement(Nothing)
            Next

            ' Validate the content of the bookstore element.
            validator.ValidateEndElement(Nothing)

            ' Close the XmlReader object.
            reader.Close()

        End Sub

        Shared schemaInfo As XmlSchemaInfo = New XmlSchemaInfo()
        Shared dateTimeGetterContent As Object

        Shared Function dateTimeGetterHandle() As Object

            Return dateTimeGetterContent

        End Function

        Shared Function dateTimeGetter(ByVal dateTime As DateTime) As XmlValueGetter

            dateTimeGetterContent = dateTime
            Return New XmlValueGetter(AddressOf dateTimeGetterHandle)

        End Function

        Shared Sub DisplaySchemaInfo()

            If Not schemaInfo.SchemaElement Is Nothing Then
                Console.WriteLine("Element '{0}' with type '{1}' is '{2}'", schemaInfo.SchemaElement.Name, schemaInfo.SchemaType, schemaInfo.Validity)
            ElseIf Not schemaInfo.SchemaAttribute Is Nothing Then
                Console.WriteLine("Attribute '{0}' with type '{1}' is '{2}'", schemaInfo.SchemaAttribute.Name, schemaInfo.SchemaType, schemaInfo.Validity)
            End If

        End Sub

        Shared Sub SchemaValidationEventHandler(ByVal sender As Object, ByVal e As ValidationEventArgs)

            Select Case e.Severity
                Case XmlSeverityType.Error
                    Console.WriteLine(vbCrLf & "Error: {0}", e.Message)
                    Exit Sub
                Case XmlSeverityType.Warning
                    Console.WriteLine(vbCrLf & "Warning: {0}", e.Message)
                    Exit Sub
            End Select

        End Sub

    End Class

    <XmlRootAttribute("bookstore", Namespace:="http://www.contoso.com/books", IsNullable:=False)> _
    Public Class ContosoBooks

        <XmlElementAttribute("book")> _
        Public book() As BookType

    End Class

    Public Class BookType

        <XmlAttributeAttribute("genre")> _
        Public Genre As String

        <XmlAttributeAttribute("publicationdate", DataType:="date")> _
        Public PublicationDate As DateTime

        <XmlAttributeAttribute("ISBN")> _
        Public Isbn As String

        <XmlElementAttribute("title")> _
        Public Title As String

        <XmlElementAttribute("author")> _
        Public Author As BookAuthor

        <XmlElementAttribute("price")> _
        Public Price As Decimal

    End Class

    Public Class BookAuthor

        <XmlElementAttribute("name")> _
        Public Name As String

        <XmlElementAttribute("first-name")> _
        Public FirstName As String

        <XmlElementAttribute("last-name")> _
        Public LastName As String

    End Class

End Namespace

この例は、contosoBooks.xml ファイルを入力として使用します。The example takes the contosoBooks.xml file as input.

<?xml version="1.0" encoding="utf-8" ?>
<bookstore xmlns="http://www.contoso.com/books">
    <book genre="autobiography" publicationdate="1981-03-22" ISBN="1-861003-11-0">
        <title>The Autobiography of Benjamin Franklin</title>
        <author>
            <first-name>Benjamin</first-name>
            <last-name>Franklin</last-name>
        </author>
        <price>8.99</price>
    </book>
    <book genre="novel" publicationdate="1967-11-17" ISBN="0-201-63361-2">
        <title>The Confidence Man</title>
        <author>
            <first-name>Herman</first-name>
            <last-name>Melville</last-name>
        </author>
        <price>11.99</price>
    </book>
    <book genre="philosophy" publicationdate="1991-02-15" ISBN="1-861001-57-6">
        <title>The Gorgias</title>
        <author>
            <name>Plato</name>
        </author>
        <price>9.99</price>
    </book>
</bookstore>

また、contosoBooks.xsd ファイルも入力として使用します。The example also takes the contosoBooks.xsd as an input.

<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.contoso.com/books" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="bookstore">
        <xs:complexType>
            <xs:sequence>
                <xs:element maxOccurs="unbounded" name="book">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="title" type="xs:string" />
                            <xs:element name="author">
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element minOccurs="0" name="name" type="xs:string" />
                                        <xs:element minOccurs="0" name="first-name" type="xs:string" />
                                        <xs:element minOccurs="0" name="last-name" type="xs:string" />
                                    </xs:sequence>
                                </xs:complexType>
                            </xs:element>
                            <xs:element name="price" type="xs:decimal" />
                        </xs:sequence>
                        <xs:attribute name="genre" type="xs:string" use="required" />
                        <xs:attribute name="publicationdate" type="xs:date" use="required" />
                        <xs:attribute name="ISBN" type="xs:string" use="required" />
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>

注釈

重要

  • 不明または信頼できないソースまたは場所からのスキーマを使用しないでください。Do not use schemas from unknown or untrusted sources or locations. これは、コードのセキュリティが低下します。Doing so will compromise the security of your code.
  • (インライン スキーマを含む) XML スキーマが本質的に、サービス拒否攻撃; に対する脆弱性信頼されていないシナリオでに受け付けられません。XML schemas (including inline schemas) are inherently vulnerable to denial of service attacks; do not accept them in untrusted scenarios.
  • スキーマ検証エラー メッセージと例外は、コンテンツ モデルまたはスキーマ ファイルの URI のパスに関する機密情報を公開できます。Schema validation error messages and exceptions may expose sensitive information about the content model or URI paths to the schema file. 信頼されていない呼び出し元にこの情報を公開しないように注意します。Be careful not to expose this information to untrusted callers.

XmlSchemaValidator は、プッシュ ベース方式で、XML スキーマを基準として XML データを検証する、効率的かつ高性能なしくみを提供します。The XmlSchemaValidator class provides an efficient, high-performance mechanism to validate XML data against XML schemas in a push-based manner. たとえば、XmlSchemaValidator クラスでは、XML 情報セットを XML ドキュメントにシリアル化してから検証型 XML リーダーを使用してドキュメントを再解析する必要なしに、情報セットをそのまま検証することができます。For example, the XmlSchemaValidator class allows you to validate an XML infoset in-place without having to serialize it as an XML document and then reparse the document using a validating XML reader. XmlSchemaValidatorクラスがカスタムの XML データ ソース全体に対して、または、検証型 XML ライターを構築する方法として、検証エンジンを構築することもできます。The XmlSchemaValidator class can also be used to build validation engines over custom XML data sources or as a way to build a validating XML writer.

詳細については、XmlSchemaValidatorクラスを参照してください、 XmlSchemaValidator のプッシュ ベースの検証トピック。For more information about the XmlSchemaValidator class, see the XmlSchemaValidator Push-Based Validation topic.

重要

ProcessInlineSchemaProcessSchemaLocationの検証フラグをXmlSchemaValidatorオブジェクトでないセットを既定にします。The ProcessInlineSchema and ProcessSchemaLocation validation flags of an XmlSchemaValidator object are not set be default. さらに、XmlResolverのプロパティ、XmlSchemaValidatorオブジェクトがnull既定。Additionally, the XmlResolver property of an XmlSchemaValidator object is null by default. その結果で参照されている外部のスキーマは、インポート、または再定義要素は解決されません既定では。As a result, external schemas referenced in include, imports, or redefine elements are not resolved by default.

コンストラクター

XmlSchemaValidator(XmlNameTable, XmlSchemaSet, IXmlNamespaceResolver, XmlSchemaValidationFlags) XmlSchemaValidator(XmlNameTable, XmlSchemaSet, IXmlNamespaceResolver, XmlSchemaValidationFlags) XmlSchemaValidator(XmlNameTable, XmlSchemaSet, IXmlNamespaceResolver, XmlSchemaValidationFlags) XmlSchemaValidator(XmlNameTable, XmlSchemaSet, IXmlNamespaceResolver, XmlSchemaValidationFlags)

XmlSchemaValidator クラスの新しいインスタンスを初期化します。Initializes a new instance of the XmlSchemaValidator class.

プロパティ

LineInfoProvider LineInfoProvider LineInfoProvider LineInfoProvider

検証する XML ノードの行番号の情報を取得または設定します。Gets or sets the line number information for the XML node being validated.

SourceUri SourceUri SourceUri SourceUri

検証する XML ノードのソース URI を取得または設定します。Gets or sets the source URI for the XML node being validated.

ValidationEventSender ValidationEventSender ValidationEventSender ValidationEventSender

検証イベントの送信元オブジェクトとして送信されるオブジェクトを取得または設定します。Gets or sets the object sent as the sender object of a validation event.

XmlResolver XmlResolver XmlResolver XmlResolver

xs:import 要素と xs:include 要素および xsi:schemaLocation 属性と xsi:noNamespaceSchemaLocation 属性の解決に使用する XmlResolver オブジェクトを設定します。Sets the XmlResolver object used to resolve xs:import and xs:include elements as well as xsi:schemaLocation and xsi:noNamespaceSchemaLocation attributes.

メソッド

AddSchema(XmlSchema) AddSchema(XmlSchema) AddSchema(XmlSchema) AddSchema(XmlSchema)

検証に使用するスキーマのセットに XML スキーマ定義言語 (XSD) スキーマを追加します。Adds an XML Schema Definition Language (XSD) schema to the set of schemas used for validation.

EndValidation() EndValidation() EndValidation() EndValidation()

検証を終了し、XML ドキュメント全体に対して ID 制約をチェックします。Ends validation and checks identity constraints for the entire XML document.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

指定したオブジェクトが、現在のオブジェクトと等しいかどうかを判断します。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetExpectedAttributes() GetExpectedAttributes() GetExpectedAttributes() GetExpectedAttributes()

現在の要素コンテキストに対して予期される属性を返します。Returns the expected attributes for the current element context.

GetExpectedParticles() GetExpectedParticles() GetExpectedParticles() GetExpectedParticles()

現在の要素コンテキストで予期されるパーティクルを返します。Returns the expected particles in the current element context.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

既定のハッシュ関数として機能します。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

現在のインスタンスの Type を取得します。Gets the Type of the current instance.

(Inherited from Object)
GetUnspecifiedDefaultAttributes(ArrayList) GetUnspecifiedDefaultAttributes(ArrayList) GetUnspecifiedDefaultAttributes(ArrayList) GetUnspecifiedDefaultAttributes(ArrayList)

既定の属性に対する ID 制約を検証します。さらに、これまで要素コンテキストで ArrayList メソッドを使用して検証されたことのない、既定値を持つ任意の属性について、XmlSchemaAttribute オブジェクトで指定された ValidateAttribute を設定します。Validates identity constraints on the default attributes and populates the ArrayList specified with XmlSchemaAttribute objects for any attributes with default values that have not been previously validated using the ValidateAttribute method in the element context.

Initialize() Initialize() Initialize() Initialize()

XmlSchemaValidator オブジェクトの状態を初期化します。Initializes the state of the XmlSchemaValidator object.

Initialize(XmlSchemaObject) Initialize(XmlSchemaObject) Initialize(XmlSchemaObject) Initialize(XmlSchemaObject)

部分検証用として指定された XmlSchemaValidator を使用して、XmlSchemaObject オブジェクトの状態を初期化します。Initializes the state of the XmlSchemaValidator object using the XmlSchemaObject specified for partial validation.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

現在の Object の簡易コピーを作成します。Creates a shallow copy of the current Object.

(Inherited from Object)
SkipToEndElement(XmlSchemaInfo) SkipToEndElement(XmlSchemaInfo) SkipToEndElement(XmlSchemaInfo) SkipToEndElement(XmlSchemaInfo)

現在の要素コンテンツの検証をスキップし、親要素のコンテキストでコンテンツの検証するために XmlSchemaValidator オブジェクトを準備します。Skips validation of the current element content and prepares the XmlSchemaValidator object to validate content in the parent element's context.

ToString() ToString() ToString() ToString()

現在のオブジェクトを表す文字列を返します。Returns a string that represents the current object.

(Inherited from Object)
ValidateAttribute(String, String, String, XmlSchemaInfo) ValidateAttribute(String, String, String, XmlSchemaInfo) ValidateAttribute(String, String, String, XmlSchemaInfo) ValidateAttribute(String, String, String, XmlSchemaInfo)

現在の要素コンテキストで属性の名前、名前空間 URI、および値を検証します。Validates the attribute name, namespace URI, and value in the current element context.

ValidateAttribute(String, String, XmlValueGetter, XmlSchemaInfo) ValidateAttribute(String, String, XmlValueGetter, XmlSchemaInfo) ValidateAttribute(String, String, XmlValueGetter, XmlSchemaInfo) ValidateAttribute(String, String, XmlValueGetter, XmlSchemaInfo)

現在の要素コンテキストで属性の名前、名前空間 URI、および値を検証します。Validates the attribute name, namespace URI, and value in the current element context.

ValidateElement(String, String, XmlSchemaInfo) ValidateElement(String, String, XmlSchemaInfo) ValidateElement(String, String, XmlSchemaInfo) ValidateElement(String, String, XmlSchemaInfo)

現在のコンテキストで要素を検証します。Validates the element in the current context.

ValidateElement(String, String, XmlSchemaInfo, String, String, String, String) ValidateElement(String, String, XmlSchemaInfo, String, String, String, String) ValidateElement(String, String, XmlSchemaInfo, String, String, String, String) ValidateElement(String, String, XmlSchemaInfo, String, String, String, String)

指定された xsi:Typexsi:Nilxsi:SchemaLocation、および xsi:NoNamespaceSchemaLocation の各属性値を使用して、現在のコンテキストで要素を検証します。Validates the element in the current context with the xsi:Type, xsi:Nil, xsi:SchemaLocation, and xsi:NoNamespaceSchemaLocation attribute values specified.

ValidateEndElement(XmlSchemaInfo) ValidateEndElement(XmlSchemaInfo) ValidateEndElement(XmlSchemaInfo) ValidateEndElement(XmlSchemaInfo)

単純な内容の要素に対しては、要素のテキストがそのデータ型に従った有効な内容かどうかについて検証し、複雑な内容の要素に対しては、現在の要素の内容が完全かどうかを検証します。Verifies if the text content of the element is valid according to its data type for elements with simple content, and verifies if the content of the current element is complete for elements with complex content.

ValidateEndElement(XmlSchemaInfo, Object) ValidateEndElement(XmlSchemaInfo, Object) ValidateEndElement(XmlSchemaInfo, Object) ValidateEndElement(XmlSchemaInfo, Object)

指定された要素のテキストが、そのデータ型に従った有効な内容であるかどうかを検証します。Verifies if the text content of the element specified is valid according to its data type.

ValidateEndOfAttributes(XmlSchemaInfo) ValidateEndOfAttributes(XmlSchemaInfo) ValidateEndOfAttributes(XmlSchemaInfo) ValidateEndOfAttributes(XmlSchemaInfo)

要素コンテキスト中の必須属性がすべて揃っていることを検証し、要素の子コンテンツを検証するために XmlSchemaValidator オブジェクトを準備します。Verifies whether all the required attributes in the element context are present and prepares the XmlSchemaValidator object to validate the child content of the element.

ValidateText(String) ValidateText(String) ValidateText(String) ValidateText(String)

現在の要素コンテキストで、指定されたテキスト string が許可されているかどうかを検証し、現在の要素が単純な内容の場合は検証用のテキストを累積します。Validates whether the text string specified is allowed in the current element context, and accumulates the text for validation if the current element has simple content.

ValidateText(XmlValueGetter) ValidateText(XmlValueGetter) ValidateText(XmlValueGetter) ValidateText(XmlValueGetter)

現在の要素コンテキストで、指定された XmlValueGetter オブジェクトで返されるテキストが許可されているかどうかを検証し、現在の要素が単純な内容の場合は検証用のテキストを累積します。Validates whether the text returned by the XmlValueGetter object specified is allowed in the current element context, and accumulates the text for validation if the current element has simple content.

ValidateWhitespace(String) ValidateWhitespace(String) ValidateWhitespace(String) ValidateWhitespace(String)

現在の要素コンテキストで、指定された string 内に空白が許可されているかどうかを検証し、現在の要素が単純な内容の場合は検証用の空白を累積します。Validates whether the white space in the string specified is allowed in the current element context, and accumulates the white space for validation if the current element has simple content.

ValidateWhitespace(XmlValueGetter) ValidateWhitespace(XmlValueGetter) ValidateWhitespace(XmlValueGetter) ValidateWhitespace(XmlValueGetter)

現在の要素コンテキストで、指定された XmlValueGetter オブジェクトで返される空白が許可されているかどうかを検証し、現在の要素が単純な内容の場合は検証用の空白を累積します。Validates whether the white space returned by the XmlValueGetter object specified is allowed in the current element context, and accumulates the white space for validation if the current element has simple content.

イベント

ValidationEventHandler ValidationEventHandler ValidationEventHandler ValidationEventHandler

スキーマを検証しているときに検出されるスキーマの検証警告と検証エラーを受信する ValidationEventHandlerThe ValidationEventHandler that receives schema validation warnings and errors encountered during schema validation.

適用対象

こちらもご覧ください