本文整理匯總了VB.NET中System.Xml.Serialization.XmlTypeMapping.XsdTypeName屬性的典型用法代碼示例。如果您正苦於以下問題:VB.NET XmlTypeMapping.XsdTypeName屬性的具體用法?VB.NET XmlTypeMapping.XsdTypeName怎麽用?VB.NET XmlTypeMapping.XsdTypeName使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類System.Xml.Serialization.XmlTypeMapping
的用法示例。
在下文中一共展示了XmlTypeMapping.XsdTypeName屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Things
' 導入命名空間
Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Xml
Imports System.Text
Namespace Company
<SoapType("TheGroup", "http://www.cohowinery.com")> _
Public Class Group
' The SoapElementAttribute specifies that the
' generated XML element name will be "Wheels"
' instead of "Vehicle".
Public GroupName As String
public Things() As Thing
<SoapElement(DataType:= "language")> _
Public Lang As String = "en"
<SoapElement(DataType:= "integer")> _
Public MyNumber As String
<SoapElement(DataType:= "duration")> _
Public ReDate As String = "8/31/01"
End Class
Public Class Thing
Public ThingName As String
End Class
Public Class Test
Shared Sub Main()
Dim t As Test = new Test()
t.GetMap("MyMap.xml")
End Sub
public Sub GetMap(filename As string )
' Create an XmlSerializer instance.
Dim map As XmlTypeMapping = new SoapReflectionImporter().ImportTypeMapping(GetType(Group))
Console.WriteLine("ElementName: " + map.ElementName)
Console.WriteLine("Namespace: " + map.Namespace)
Console.WriteLine("TypeFullName: " + map.TypeFullName)
Console.WriteLine("TypeName: " + map.TypeName)
Dim ser As XmlSerializer= new XmlSerializer(map)
Dim xGroup As Group = new Group()
xGroup.GroupName= "MyCar"
xGroup.MyNumber= 5454.ToString()
xGroup.Things = new Thing(){new Thing(), new Thing()}
' To write the outer wrapper, use an XmlTextWriter.
Dim writer As XmlTextWriter = _
new XmlTextWriter(filename, Encoding.UTF8)
writer.Formatting = Formatting.Indented
writer.WriteStartElement("wrapper")
ser.Serialize(writer, xGroup)
writer.WriteEndElement()
writer.Close()
End Sub
End Class
End namespace