Überprüft ob das Xml file dem angegebenen Schema entspricht

 
Assembly: EDKB12WS (in EDKB12WS.exe)

Syntax

Visual Basic

Private Function IsValid( _
   ByVal xmlImportFile As FileInfo _
) As Boolean

C#

private bool IsValid(
   FileInfoxmlImportFile
)

C++

private: 
bool IsValid(
   FileInfoxmlImportFile

JScript

private function IsValid(
    xmlImportFile : FileInfo
) : boolean;

Parameters

xmlImportFile

 

 

 

 

Source code

Visual Basic

 Private Function IsValid(ByVal xmlImportFile As FileInfo) As Boolean
    Dim reader As New XmlTextReader(xmlImportFile.FullName)
    'We pass the xmltextreader into the xmlvalidatingreader
    'This will validate the xml doc with the schema file
    'NOTE the xml file it self points to the schema file
 
    Dim validator As New XmlValidatingReader(reader)
    Try
        'First we create the xmltextreader
 
 
        ' Set the validation event handler
        'AddHandler validator.ValidationEventHandler, _
        'AddressOf ValidationCallback
        _validationSuccess = True            'make sure to reset the success var
 
        ' Read XML data
        While (validator.Read)
        End While
        'Close the reader.
        validator.Close()
 
        reader.Close()
 
        'The validationeventhandler is the only thing that would 
        'set m_Success to false
        Return _validationSuccess
    Catch ex As Exception
        validator.Close()
        reader.Close()
 
        _validationSuccess = False
        _validationSuccess = False
        Return _validationSuccess
        Throw ex
    End Try
 End Function 

Platforms

Windows 8, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

 

Version Information

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0
 

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0
 

XNA Framework

Supported in: 3.0, 2.0, 1.0
 

 

See Also