Imports System
Imports System.Xml
Imports System.Xml.Schema
Class XMLSchemaExamples
Public Shared Sub Main()
Dim schema As New XmlSchema()
Dim ZipCodeType As New XmlSchemaSimpleType()
ZipCodeType.Name = "ZipCodeType"
Dim restriction As New XmlSchemaSimpleTypeRestriction()
restriction.BaseTypeName = New XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema")
Dim length As New XmlSchemaLengthFacet()
length.Value = "5"
restriction.Facets.Add(length)
ZipCodeType.Content = restriction
schema.Items.Add(ZipCodeType)
Dim element As New XmlSchemaElement()
element.Name = "Address"
Dim complexType As New XmlSchemaComplexType()
Dim ZipCodeAttribute As New XmlSchemaAttribute()
ZipCodeAttribute.Name = "ZipCode"
ZipCodeAttribute.SchemaTypeName = New XmlQualifiedName("ZipCodeType", "")
complexType.Attributes.Add(ZipCodeAttribute)
element.SchemaType = complexType
schema.Items.Add(element)
End Sub
End Class