當前位置: 首頁>>代碼示例>>VB.NET>>正文


VB.NET XmlSchemaElement.SchemaTypeName屬性代碼示例

本文整理匯總了VB.NET中System.Xml.Schema.XmlSchemaElement.SchemaTypeName屬性的典型用法代碼示例。如果您正苦於以下問題:VB.NET XmlSchemaElement.SchemaTypeName屬性的具體用法?VB.NET XmlSchemaElement.SchemaTypeName怎麽用?VB.NET XmlSchemaElement.SchemaTypeName使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在System.Xml.Schema.XmlSchemaElement的用法示例。


在下文中一共展示了XmlSchemaElement.SchemaTypeName屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。

示例1: Test

' 導入命名空間
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
開發者ID:VB程序員,項目名稱:System.Xml.Schema,代碼行數:128,代碼來源:XmlSchemaElement.SchemaTypeName


注:本文中的System.Xml.Schema.XmlSchemaElement.SchemaTypeName屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。