Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


XML Schema validation

Posted on 2006-03-28
Medium Priority
Last Modified: 2013-11-19
I have a xml file that I load from an xml file (test.xml).  I also have a schema on my computer called (validate.xsd).  The xml file changes constantly, and it doesn't reference the schema file.  How do I load the xml file (preferably in an xmldocument object) and then validate the xml against the schema??
Question by:macros14

Author Comment

ID: 16312317
Yeah I figured it out

    Private Function LoadAndValidateXML(ByVal sXMLPath As String) As XmlDocument
        Dim doc As XmlDocument = New XmlDocument
        Dim tr As XmlTextReader = New XmlTextReader(sXMLPath)
        Dim reader As XmlValidatingReader = New XmlValidatingReader(tr)
        Dim xsc As Xml.Schema.XmlSchemaCollection = New Xml.Schema.XmlSchemaCollection
        xsc.Add(Nothing, "D:\apps\LendPro\Data\Schema\LendersProtectionFeedv4.xsd")

    End Function

Accepted Solution

GranMod earned 0 total points
ID: 16518557
PAQed with points refunded (500)

Community Support Moderator

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question