Recently I stumbled again over a need to use and validate XML in a project, as done so many times before. It’s not all JSON yet 😉 So with Visual Studio Code rocking I asked myself if it is possible to support XML in VSCode (sure it can) and if there is a support for XML validation with XSD.
Searching the VS Code marketspace there seems to be a significant extension doing it all named, wonder wonder, XML:
It even states that a Java installation is unnecessary, making it even better and more independent, I guess.
What’s to validate
So I guess it makes sense to have an XML File ready to validate for which we then need the according XSD file to validate. You can grab yourself both for example on W3Schools:
So your XSD would look something like this:
And your XML file is like this:
Store them both in a preferred location on your disk and then let’s check out the XML extension
Let’s use the XML extension
Could not be easier. Open the XML File in VS Code and possible errors or problems will be detected automatically: