Mega Code Archive

 
Categories / VB.Net / XML
 

XmlSchemaChoice Class represents choice element from XML Schema

Option Strict On Option Explicit On Imports System Imports System.Xml Imports System.Xml.Schema Class XMLSchemaExamples     Public Shared Sub Main()         Dim schema As New XmlSchema()         Dim xeSelected As New XmlSchemaElement()         xeSelected.Name = "selected"         schema.Items.Add(xeSelected)         Dim xeUnselected As New XmlSchemaElement()         xeUnselected.Name = "unselected"         schema.Items.Add(xeUnselected)         Dim cState As New XmlSchemaComplexType()         schema.Items.Add(cState)         cState.Name = "cState"         Dim choice As New XmlSchemaChoice()         cState.Particle = choice         choice.MinOccurs = 1         choice.MaxOccurs = 1         Dim elementSelected As New XmlSchemaElement()         choice.Items.Add(elementSelected)         elementSelected.RefName = New XmlQualifiedName("selected")         Dim elementUnselected As New XmlSchemaElement()         choice.Items.Add(elementUnselected)         elementUnselected.RefName = New XmlQualifiedName("unselected")         Dim elementDimpled As New XmlSchemaElement()         choice.Items.Add(elementDimpled)         elementDimpled.RefName = New XmlQualifiedName("dimpled")         Dim elementPerforated As New XmlSchemaElement()         choice.Items.Add(elementPerforated)         elementPerforated.RefName = New XmlQualifiedName("perforated")     End Sub End Class