本文整理汇总了VB.NET中System.Xml.Schema.XmlSchemaDatatype类的典型用法代码示例。如果您正苦于以下问题:VB.NET XmlSchemaDatatype类的具体用法?VB.NET XmlSchemaDatatype怎么用?VB.NET XmlSchemaDatatype使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XmlSchemaDatatype类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: Main
' 导入命名空间
Imports System.Xml
Imports System.Xml.Schema
_
Class XMLSchemaExamples
Public Shared Sub Main()
Dim xtr As New XmlTextReader("example.xsd")
Dim schema As XmlSchema = XmlSchema.Read(xtr, New ValidationEventHandler(AddressOf ValidationCallbackOne))
Dim schemaSet As New XmlSchemaSet()
AddHandler schemaSet.ValidationEventHandler, AddressOf ValidationCallbackOne
schemaSet.Add(schema)
schemaSet.Compile()
Dim compiledSchema As XmlSchema = Nothing
For Each schema1 As XmlSchema In schemaSet.Schemas()
compiledSchema = schema1
Next
Dim schemaObject As XmlSchemaObject
For Each schemaObject In compiledSchema.Items
If schemaObject.GetType() Is GetType(XmlSchemaSimpleType) Then
Dim simpleType As XmlSchemaSimpleType = CType(schemaObject, XmlSchemaSimpleType)
Console.WriteLine("{0} {1}", simpleType.Name, simpleType.Datatype.ValueType)
End If
If schemaObject.GetType() Is GetType(XmlSchemaComplexType) Then
Dim complexType As XmlSchemaComplexType = CType(schemaObject, XmlSchemaComplexType)
Console.WriteLine("{0} {1}", complexType.Name, complexType.Datatype.ValueType)
End If
Next schemaObject
xtr.Close()
End Sub
Public Shared Sub ValidationCallbackOne(ByVal sender As Object, ByVal args As ValidationEventArgs)
Console.WriteLine(args.Message)
End Sub
End Class