Validating XML document against an XML Schema with VB.Net

It seems like validating an XML document against a schema would be a pretty simple thing to do in the .Net framework, seeing as how they have such deep support for dealing with XML.

But as of yet, I haven’t found a simple way to do it.

Here is the code I have been using to validate XML against an XML Schema.

Imports System.IO
Imports System.Xml
Imports System.Xml.Schema

Private schemaValidation As New ValidationEventHandler(AddressOf ValidationHandler)

Private Function ValidateXml(ByVal xmlFileName As String, ByVal xmlSchemaName As String) As Boolean
Using myFile As New FileStream(xmlFileName, FileMode.Open, FileAccess.Read, FileShare.None)
Dim xDoc As New Xml.XmlDocument()
Return True
Catch ex As XmlSchemaValidationException
Return False
Catch ex As XmlSchemaException
Return False
Catch ex As Exception
Return False
End Try
End Using
End Function

Private Function GetSchema(ByVal filePath As String) As XmlSchema
Dim schema As XmlSchema
Using s As New System.IO.FileStream(filePath, FileMode.Open)
Using reader As New StreamReader(s)
schema = XmlSchema.Read(reader, Nothing)
End Using
End Using
Return schema
End Function

Private Sub ValidationHandler(ByVal sender As Object, ByVal e As System.Xml.Schema.ValidationEventArgs)
Throw e.Exception
End Sub

Here Is A Article Talking About The Ability To Put Some Of Your Config Info In Another Config File When Using Aspnet

Here is a article talking about the ability to put some of your .config info in another config file when using

What I found most interesting is that it says that changing the otherFile.config will not reset your app.

I am guessing that it also means that it won’t find your new values until the app is reloaded, but if it DID find the new values w/o a reload that would be great.

<?xml version=1.0?>
        <compilation debug=false strict=false explicit=true />
    <appSettings file=externalSettings.config/>

I also wonder if you could have more than 1 appSettings external file.

Some Good Links For Updating Cisco PIX Devices

Problem getting PDM running:

Installing PDF on a Pix Firewall:

Upgrade/Update/Flash a Cisco Pix:

Change Password on Pix: