Click here to Skip to main content
11,928,587 members (48,537 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


4 bookmarked

How to Add Custom XSD Validation Intellisense in Visual Studio

, 15 Feb 2015 CPOL
Rate this:
Please Sign up or sign in to vote.
This tip shows how you can add an XSD schema in Visual Studio to enable XML intellisense.


This tip will show you how you can add an XSD to Visual Studio in order to enable Intellisense for that particular XSD when creating an XML file.


For many integration solutions, we still rely heavily on parsing XML from some source. Often a SFTP location or file share or even a direct download link.

The issue with XML is that it is often quite prone to user errors. The XML needs to be formed just for the XML Parser to be able to process it. To make this easier, we came up with the XSD. Basically, it's a file with a definition containing the set of rules on which the XML should comply to.

Creating an XSD using Visual Studio is actually quite easy as well and it is useful if for example you have already defined a set of classes/entities and want just an XML file that follows your entity hierarchy and do a simple serialize/deserialize of the XML. (see:

But what if you want to write an XML in Visual Studio and ensure you are complying to the XSD and perhaps even get some intellisense?

Add XSD to Schema Validation

This is where this tip comes in. I decided to add this as I have stumbled at it when I had to write an example XML after I found that the third party I had send an XSD to implement had made lots of errors.

Checking to see if an XML matches validation can easily be done by validating it online. I've searched on Google and found, but there were a whole bunch of validators. There's no need to write some C# code yourself to validate an XSD for these kinds of tests.

To add your XSD to the Schema Validation, you merely have to open the XML editor. For example, open the XML file in Visual Studio. Then once inside, go to properties and click on the Schemas Button.

Or in Visual Studio 2013, you can go to Schemas directly from the XML Menu. I've not noticed this in Visual Studio 2010 for example.

One you open the XML Schema, you will see a large list of XSD Schemas. The one which has a tick box in the "Use" column will be actually used in the XML that you are working on. So make sure that when you've added the XSD that you also set the tick on "Use".

Once you are working on the XML file than at least Visual Studio 2013, you can also just click F12 and you will be navigated directly to the XSD part that is relevant for that XML node you came from.

Also, there is no need for running some separate XML validator like the link I showed in the beginning as we now have IntelliSense and so also get warnings if the XML is not compliant to the used XSD Schemas.

All in all, I found this a very useful way to ensure that the XML samples I sent to the third parties that need to implement my XSD are valid.

Hopefully, you will find this tip useful.


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


About the Author

Netherlands Netherlands
No Biography provided

You may also be interested in...

Comments and Discussions

-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.151126.1 | Last Updated 16 Feb 2015
Article Copyright 2015 by RemcoReitsma
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid