XmlSchemaException クラス
アセンブリ: System.Xml (system.xml.dll 内)


![]() |
---|
XmlSchemaException クラスには、信頼関係のないシナリオで公開されてはならないような機密情報が含まれている場合があります。たとえば、SourceUri プロパティは、例外が発生する原因となったスキーマ ファイルへの URI パスを返します。信頼関係のないシナリオでは、SourceUri プロパティを公開しないでください。こういった機密情報が信頼関係のないシナリオで公開されてしまわないよう、例外は適切に処理する必要があります。 |

XmlSchemaException クラスを使用する例を次に示します。
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
using System; using System.Xml; using System.Xml.Schema; using System.IO; public class ValidXSD { public static int Main() { FileStream fs; XmlSchema schema; try { fs = new FileStream("example.xsd", FileMode.Open); schema = XmlSchema.Read(fs, new ValidationEventHandler(ShowCompileError)); XmlSchemaSet schemaSet = new XmlSchemaSet(); schemaSet.ValidationEventHandler += new ValidationEventHandler(ShowCompileError); schemaSet.Add(schema); schemaSet.Compile(); XmlSchema compiledSchema = null; foreach (XmlSchema schema1 in schemaSet.Schemas()) { compiledSchema = schema1; } schema = compiledSchema; if (schema.IsCompiled) { // Schema is successfully compiled. // Do something with it here. } return 0; } catch (XmlSchemaException e) { Console.WriteLine("LineNumber = {0}", e.LineNumber); Console.WriteLine("LinePosition = {0}", e.LinePosition); Console.WriteLine("Message = {0}", e.Message); return -1; } } private static void ShowCompileError(object sender, ValidationEventArgs e) { Console.WriteLine("Validation Error: {0}", e.Message); } }

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
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からXmlSchemaException クラスを検索する場合は、下記のリンクをクリックしてください。

- XmlSchemaException クラスのページへのリンク