What is an XSD Schema file?
An XSD file is a definition file specifying the elements and attributes that can be part of an XML document. This ensures that data is properly interpreted, and errors are caught, resulting in appropriate XML validation. XSD files ensure that the data entered follows the same structure as defined in the file. XSD files are stored in XML file format and can be opened or edited in any text editor such as Microsoft Notepad, Notepad++, or Microsoft XML Notepad.
XSD File Format
XSD files are stored to disc in plain text file format that is human readable. An XSD defines the elements that can be used in the documents, relating to the actual data with which it is to be encoded.
Example of XSD File
A simple XSD file having a purchase order schema defines the elements using tags as shown in following XSD example by Microsoft.
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://tempuri.org/PurchaseOrderSchema.xsd"
targetNamespace="http://tempuri.org/PurchaseOrderSchema.xsd"
elementFormDefault="qualified">
<xsd:element name="PurchaseOrder" type="tns:PurchaseOrderType"/>
<xsd:complexType name="PurchaseOrderType">
<xsd:sequence>
<xsd:element name="ShipTo" type="tns:USAddress" maxOccurs="2"/>
<xsd:element name="BillTo" type="tns:USAddress"/>
</xsd:sequence>
<xsd:attribute name="OrderDate" type="xsd:date"/>
</xsd:complexType>
<xsd:complexType name="USAddress">
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="street" type="xsd:string"/>
<xsd:element name="city" type="xsd:string"/>
<xsd:element name="state" type="xsd:string"/>
<xsd:element name="zip" type="xsd:integer"/>
</xsd:sequence>
<xsd:attribute name="country" type="xsd:NMTOKEN" fixed="US"/>
</xsd:complexType>
</xsd:schema>
Here, the following tags are used.
xs:element
- Defines an element.xs:sequence
- Denotes child elements only appear in the order mentioned.xs:complexType
- Denotes it contains other elements.xs:simpleType
- Denotes they do not contain other elements.type
- string, decimal, integer, boolean, date, time,
How to open XSD file?
To open an XSD file (XML Schema Definition), you can use a variety of tools depending on whether you want to view, edit, or validate it.
1. Text or Code Editors (For Viewing & Editing) XSD files are plain text files written in XML, so any text editor will work.
Popular Options:
- Visual Studio Code (recommended – with XML extensions)
- Notepad++ (Windows)
- Sublime Text
- Atom
- VS (Visual Studio) – offers full XML schema editing features
2. Online XSD Viewers & Validators These let you view or validate XSD files without installing software:
3. Integrated Development Environments (IDEs) If you’re working with XML in a software project, IDEs can help:
- Eclipse (with XML plugins)
- IntelliJ IDEA
- NetBeans
These provide schema-aware editing and validation tools.
4. Web Browsers (For Quick Viewing)
- You can open an XSD file in any modern browser (like Chrome or Firefox).
- Just drag and drop the file into the browser window—it will display the XML content (not styled, but readable).