本文整理汇总了VB.NET中System.Xml.Schema.XmlSchemaInclude类的典型用法代码示例。如果您正苦于以下问题:VB.NET XmlSchemaInclude类的具体用法?VB.NET XmlSchemaInclude怎么用?VB.NET XmlSchemaInclude使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XmlSchemaInclude类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: ImportIncludeSample
' 导入命名空间
Imports System.Collections
Imports System.IO
Imports System.Xml
Imports System.Xml.Xsl
Imports System.Xml.Schema
Public Class ImportIncludeSample
Private Shared Sub ValidationCallBack(ByVal sender As Object, ByVal args As ValidationEventArgs)
If args.Severity = XmlSeverityType.Warning Then
Console.Write("WARNING: ")
Else
If args.Severity = XmlSeverityType.Error Then
Console.Write("ERROR: ")
End If
End If
Console.WriteLine(args.Message)
End Sub
Public Shared Sub Main()
Dim schema As New XmlSchema()
schema.ElementFormDefault = XmlSchemaForm.Qualified
schema.TargetNamespace = "http://www.w3.org/2001/05/XMLInfoset"
' <xs:import namespace="http://www.example.com/IPO" />
Dim import As New XmlSchemaImport()
import.Namespace = "http://www.example.com/IPO"
schema.Includes.Add(import)
' <xs:include schemaLocation="example.xsd" />
Dim include As New XmlSchemaInclude()
include.SchemaLocation = "example.xsd"
schema.Includes.Add(include)
Dim schemaSet As New XmlSchemaSet()
AddHandler schemaSet.ValidationEventHandler, AddressOf ValidationCallBack
schemaSet.Add(schema)
schemaSet.Compile()
Dim compiledSchema As XmlSchema = Nothing
For Each schema1 As XmlSchema In schemaSet.Schemas()
compiledSchema = schema1
Next
Dim nsmgr As XmlNamespaceManager = New XmlNamespaceManager(New NameTable())
nsmgr.AddNamespace("xs", "http://www.w3.org/2001/XMLSchema")
compiledSchema.Write(Console.Out, nsmgr)
End Sub
End Class
'ImportIncludeSample