Click here to Skip to main content
Click here to Skip to main content

Simple and Cool XML Validator

, 27 Sep 2007
Rate this:
Please Sign up or sign in to vote.
A small program you can use to validate an XML document against a schema

Background

I woke up one morning and decided to read about XML. In the video tutorial that I was watching on my computer, the instructor used a self made XML Validator to test the XML and XSD documents he created. I searched the whole DVD-ROM for the Validator, but… it wasn't there. So, I decided to write one that I could use, and also put it up for public use here on The Code Project. Here is the result (it took me half a day to get it to work).

Introduction

This small program will help you validate your XML document/database/... against your laid down specification (schema). The interface is so simple that you'll understand what to do and how to use it once you see it. I didn't do any digging into the source code, because it's mostly Microsoft's code - I only implemented it.

It's very easy to operate the machine; it looks like this:

Screenshot - image001.png

Load the XML schema file by clicking the button next to the XML Schema File textbox; it displays an open file dialog. Browse the folders for your schema file and click open.

In the textbox below, a message appears telling you if your schema file was valid or not. If you had a valid schema file, you might want to validate an XML document against it. The button next to the XML document textbox will open an open file dialog box for you to select your XML document. The moment you load the document, it gets checked if it’s a valid XML document. By this time, the validate button will have been activated. Click this button to validate the XML document against the schema file you specified. If the document conforms to the schema, you'll get a “Document validation against Schema was successful” message. Below is a sample output:

Screenshot - image003.png

The code is rather shabby, but it's easy to understand. If you have a question about the code, please feel free to ask.

History

  • 27th September, 2007: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Seun
Web Developer TEDATA
Nigeria Nigeria
Seun (Laolusrael) loves programming. I learnt 80% of what I know in programming all alone. I use my God-given mind to do a lot of thinking, and...
Currently Seun is a student studying software engineering, and working freelance.
Follow on   Twitter

Comments and Discussions

 
GeneralEnhancement.... PinmemberAnurag Gandhi27-Sep-07 19:04 
GeneralRe: Enhancement.... PinmemberSeun28-Sep-07 4:38 
GeneralRe: Enhancement.... Pinmemberzorrothefox6-Jan-09 19:16 
GeneralRe: Enhancement.... PinmemberSeun16-Jan-09 12:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.140827.1 | Last Updated 27 Sep 2007
Article Copyright 2007 by Seun
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid