Imports System
Imports System.Xml
Imports System.Xml.Schema
Class XMLSchemaExamples
Public Shared Sub Main()
Dim schema As New XmlSchema()
Dim simpleType As New XmlSchemaSimpleType()
simpleType.Name = "northwestStates"
schema.Items.Add(simpleType)
Dim annNorthwestStates As New XmlSchemaAnnotation()
simpleType.Annotation = annNorthwestStates
Dim docNorthwestStates As New XmlSchemaDocumentation()
annNorthwestStates.Items.Add(docNorthwestStates)
docNorthwestStates.Markup = TextToNodeArray("test")
Dim restriction As New XmlSchemaSimpleTypeRestriction()
simpleType.Content = restriction
restriction.BaseTypeName = New XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema")
Dim enumerationWA As New XmlSchemaEnumerationFacet()
restriction.Facets.Add(enumerationWA)
enumerationWA.Value = "WA"
Dim annWA As New XmlSchemaAnnotation()
enumerationWA.Annotation = annWA
Dim docWA As New XmlSchemaDocumentation()
annWA.Items.Add(docWA)
docWA.Markup = TextToNodeArray("Washington")
Dim enumerationOR As New XmlSchemaEnumerationFacet()
restriction.Facets.Add(enumerationOR)
enumerationOR.Value = "OR"
Dim annOR As New XmlSchemaAnnotation()
enumerationOR.Annotation = annOR
Dim docOR As New XmlSchemaDocumentation()
annOR.Items.Add(docOR)
docOR.Markup = TextToNodeArray("Oregon")
End Sub
Public Shared Function TextToNodeArray(ByVal text As String) As XmlNode()
Dim doc As New XmlDocument()
Dim nodeArray(1) As XmlNode
nodeArray(0) = doc.CreateTextNode(text)
TextToNodeArray = nodeArray
End Function
End Class