VB.Net by API/System.Xml.Schema/XmlSchemaSequence — различия между версиями

Материал из VB Эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Текущая версия на 12:50, 26 мая 2010

New XmlSchemaSequence

  
Imports System
Imports System.Xml
Imports System.Xml.Schema
Imports System.IO
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Collections
Imports System.Data
Imports System.Windows.Forms

Public Class MainClass
    
    Shared Sub Main()
        Dim Schema As XmlSchema = New XmlSchema()
        Dim ElementBook As New XmlSchemaElement()
        Schema.Items.Add(ElementBook)
        ElementBook.Name = "Book"
        Dim ComplexType As New XmlSchemaComplexType()
        ElementBook.SchemaType = ComplexType
        Dim Sequence As New XmlSchemaSequence()
        ComplexType.Particle = Sequence
        Dim ElementTitle As New XmlSchemaElement()
        ElementTitle.Name = "Title"
        ElementTitle.SchemaTypeName = New XmlQualifiedName("string", _
                                       "http://www.w3.org/2001/XMLSchema")
        Dim ElementPublisher As New XmlSchemaElement()
        ElementPublisher.Name = "Publisher"
        ElementPublisher.SchemaTypeName = New XmlQualifiedName("string", _
                                       "http://www.w3.org/2001/XMLSchema")
        Sequence.Items.Add(ElementTitle)
        Sequence.Items.Add(ElementPublisher)
        Schema.rupile(New ValidationEventHandler(AddressOf ValidationHandler))
        Schema.Write(Console.Out)
    End Sub
    Shared Sub ValidationHandler(ByVal sender As Object, _
                          ByVal args As ValidationEventArgs)
        Console.WriteLine("Schema Validation Failed.")
        Console.WriteLine(args.Message)
    End Sub
End Class