We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


XML Schema validation

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??
Watch Question


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
PAQed with points refunded (500)

Community Support Moderator

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.