XmlSchemaElement.MinOccurs : XmlSchemaElement « System.Xml.Schema « VB.Net by API

Home
VB.Net by API
1.Microsoft.VisualBasic
2.Microsoft.Win32
3.System
4.System.Collections
5.System.Collections.Generic
6.System.Collections.Specialized
7.System.ComponentModel
8.System.Configuration.ConfigurationSettings
9.System.Data
10.System.Data.Odbc
11.System.Data.OleDb
12.System.Data.OracleClient
13.System.Data.SqlClient
14.System.Diagnostics
15.System.Drawing
16.System.Drawing.Drawing2D
17.System.Drawing.Imaging
18.System.Drawing.Printing
19.System.Drawing.Text
20.System.Globalization
21.System.IO
22.System.IO.IsolatedStorage
23.System.IO.Ports
24.System.Media
25.System.Messaging
26.System.Net
27.System.Net.Sockets
28.System.Reflection
29.System.Runtime.InteropServices
30.System.Runtime.Remoting.Channels
31.System.Runtime.Serialization
32.System.Runtime.Serialization.Formatters.Binary
33.System.Runtime.Serialization.Formatters.Soap
34.System.Security.Cryptography
35.System.Security.Cryptography.X509Certificates
36.System.Security.Permissions
37.System.Security.Principal
38.System.ServiceProcess
39.System.Text
40.System.Text.RegularExpressions
41.System.Threading
42.System.Web
43.System.Web.Mail
44.System.Windows.Forms
45.System.Xml
46.System.Xml.Schema
47.System.Xml.Serialization
48.System.Xml.Xsl
VB.Net
VB.Net Tutorial
VB.Net by API » System.Xml.Schema » XmlSchemaElement 
XmlSchemaElement.MinOccurs
  

        

Imports System.IO
Imports System.Xml
Imports System.Xml.Schema


public class Test
   public Shared Sub Main
        Dim XS As New XmlSchema()

        Dim Personal As New XmlSchemaElement()
        Personal.Name = "Personal"
        Personal.SchemaTypeName = New XmlQualifiedName("boolean""http://www.w3.org/2001/XMLSchema")

        Dim Business As New XmlSchemaElement()
        Business.Name = "BusType"
        Dim BusType As New XmlSchemaComplexType()
        Dim BusSeq As New XmlSchemaSequence()

        Dim Position As New XmlSchemaElement()
        Position.Name = "Position"
        Position.MinOccurs = 1
        Position.MaxOccurs = 1
        Position.SchemaTypeName = New XmlQualifiedName("string""http://www.w3.org/2001/XMLSchema")

        Dim CompanyName As New XmlSchemaElement()
        CompanyName.Name = "CompanyName"
        CompanyName.MinOccurs = 1
        CompanyName.MaxOccurs = 1
        CompanyName.SchemaTypeName = New XmlQualifiedName("string""http://www.w3.org/2001/XMLSchema")

        BusSeq.Items.Add(Position)
        BusSeq.Items.Add(CompanyName)
        BusType.Particle = BusSeq
        Business.SchemaType = BusType

        XS.Items.Add(Personal)
        XS.Items.Add(Business)

        Dim MyAddress As New XmlSchemaElement
        MyAddress.Name = "Addresses"

        Dim MyAddressType As New XmlSchemaComplexType()

        Dim MyAddressSeq As New XmlSchemaSequence()

        Dim Items As New XmlSchemaElement()
        Items.Name = "Item"
        Items.MinOccurs = 1
        Items.MaxOccursString = "unbounded"

        Dim ThisType As New XmlSchemaComplexType()

        Dim ThisSeq As New XmlSchemaSequence()

        Dim FName As New XmlSchemaElement()
        FName.Name = "FirstName"
        FName.MinOccurs = 1
        FName.MaxOccurs = 1
        FName.SchemaTypeName = New XmlQualifiedName("string""http://www.w3.org/2001/XMLSchema")

        Dim LName As New XmlSchemaElement()
        LName.Name = "LastName"
        LName.MinOccurs = 1
        LName.MaxOccurs = 1
        LName.SchemaTypeName = New XmlQualifiedName("string""http://www.w3.org/2001/XMLSchema")

        Dim Address As New XmlSchemaElement()
        Address.Name = "Address"
        Address.MinOccurs = 1
        Address.MaxOccursString = "unbounded"
        Address.SchemaTypeName = New XmlQualifiedName("string""http://www.w3.org/2001/XMLSchema")


        Dim City As New XmlSchemaElement()
        City.Name = "City"
        City.MinOccurs = 1
        City.MaxOccurs = 1
        City.SchemaTypeName = New XmlQualifiedName("string""http://www.w3.org/2001/XMLSchema")

        Dim Region As New XmlSchemaElement()
        Region.Name = "Region"
        Region.MinOccurs = 0
        Region.MaxOccurs = 1
        Region.SchemaTypeName = New XmlQualifiedName("string""http://www.w3.org/2001/XMLSchema")


        Dim PostalCode As New XmlSchemaElement()
        PostalCode.Name = "PostalCode"
        PostalCode.MinOccurs = 0
        PostalCode.MaxOccurs = 1
        PostalCode.SchemaTypeName = New XmlQualifiedName("string""http://www.w3.org/2001/XMLSchema")

        Dim PersOrBus As New XmlSchemaChoice()
        PersOrBus.MinOccurs = 1
        PersOrBus.MaxOccurs = 1

        Dim PersRef As New XmlSchemaElement()
        PersRef.RefName = New XmlQualifiedName("Personal")
        PersOrBus.Items.Add(PersRef)

        Dim BusRef As New XmlSchemaElement()
        BusRef.RefName = New XmlQualifiedName("BusType")
        PersOrBus.Items.Add(BusRef)

        ThisSeq.Items.Add(FName)
        ThisSeq.Items.Add(LName)
        ThisSeq.Items.Add(PersOrBus)
        ThisSeq.Items.Add(Address)
        ThisSeq.Items.Add(City)
        ThisSeq.Items.Add(Region)
        ThisSeq.Items.Add(PostalCode)

        ThisType.Particle = ThisSeq

        Items.SchemaType = ThisType

        MyAddressSeq.Items.Add(Items)
        MyAddressType.Particle = MyAddressSeq
        MyAddress.SchemaType = MyAddressType

        XS.Items.Add(MyAddress)

        Dim Output As New XmlTextWriter("TestSchema.xsd", System.Text.Encoding.UTF8)
        XS.Write(Output)
        Output.Close()
   End Sub
End class

   
    
  
Related examples in the same category
1.XmlSchemaElement.MaxOccurs
2.XmlSchemaElement.Name
3.XmlSchemaElement.SchemaTypeName
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.