XmlSchemaException Class
Assembly: System.Xml (in system.xml.dll)
'Declaration <SerializableAttribute> _ Public Class XmlSchemaException Inherits SystemException 'Usage Dim instance As XmlSchemaException
/** @attribute SerializableAttribute() */ public class XmlSchemaException extends SystemException
SerializableAttribute public class XmlSchemaException extends SystemException
Security Note |
|---|
| The XmlSchemaException class may contain sensitive information that should not be exposed in untrusted scenarios. For example, the SourceUri property returns the URI path to the schema file that caused the exception. The SourceUri property should not be exposed in untrusted scenarios. Exceptions should be properly handled so that this sensitive information is not exposed in untrusted scenarios. |
The following example shows the use of the XmlSchemaException class.
Option Strict On Option Explicit On Imports System Imports System.Xml Imports System.Xml.Schema Imports System.IO Imports Microsoft.VisualBasic Public Class ValidXSD Public Shared Sub Main() Dim fs As FileStream Dim schema As XmlSchema Try fs = New FileStream("example.xsd", FileMode.Open) schema = XmlSchema.Read(fs, New ValidationEventHandler(AddressOf ShowCompileError)) Dim schemaSet As New XmlSchemaSet() AddHandler schemaSet.ValidationEventHandler, AddressOf ShowCompileError schemaSet.Add(schema) schemaSet.Compile() Dim compiledSchema As XmlSchema = Nothing For Each schema1 As XmlSchema In schemaSet.Schemas() compiledSchema = schema1 Next schema = compiledSchema If schema.IsCompiled Then ' Schema is successfully compiled. ' Do something with it here. End If Catch e As XmlSchemaException Console.WriteLine("LineNumber = {0}", e.LineNumber) Console.WriteLine("LinePosition = {0}", e.LinePosition) Console.WriteLine("Message = {0}", e.Message) Console.WriteLine("Source = {0}", e.Source) End Try End Sub 'Main Private Shared Sub ShowCompileError(ByVal sender As Object, ByVal e As ValidationEventArgs) Console.WriteLine("Validation Error: {0}", e.Message) End Sub 'ShowCompileError End Class 'ValidXSD
System.Exception
System.SystemException
System.Xml.Schema.XmlSchemaException
System.Xml.Schema.XmlSchemaInferenceException
System.Xml.Schema.XmlSchemaValidationException
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
Security Note