What Is XSD (XML Schema Definition)? – POFTUT

What Is XSD (XML Schema Definition)?

XSD or XML Schema Definition is a schema definition document which will provide the definition of different type of objects and entities in XML language. XSD is very popular for data exchange especially in enterprise environments because of different advantages. In this tutorial, we will examine XSD, XSD syntax, XSD usage.

What Is XML?

Before explaining the XSD we should explain the XML language. XML the short form of the eXtensible Markup Language which is designed to extend different data types in a structured manner. XML is very popular because of its clarity and structured definition. Below we can find some XML statements.

What Is XML Schema?

XML Schema is the complete XML document that describes the XML document. XML schema contains the version, schema URI data types, etc. Below we can see a complete XML schema that simply defines the Person entity.

LEARN MORE  How To Grep Text Files With Powershell Grep or Select-String Cmdlet In Windows?

What Is XML Schema Definition?

Well, actually we have learned the XSD or XML Schema Definition because the XML Schema language also named XSD. A typical XSD contains the following elements and information about the XML.

  • Elements that can appear in a XML document.
  • Attributes that can be used for elements in an XML document.
  • Data Types for defined elements and attributes.
  • Default and fixed values for elements and attributes.
  • XSD version will set the XML version.

XSD Syntax

XSD has a very structured syntax. As a markup language like HTML, most of the elements are defined with start and end tags. XSD express the hierarchy between elements in order to create a child and parent relation. This hierarchical usage provides the ability to create complex data structures easily and relate them to each other.

  • <xs:element name="Person"> will create a data type named Person and the details will be defined inside this tag.
  • <xs:complexType> is used to create multiple different elements inside Person data type.
  • <xs:sequence> creates a sequence where we can put multiple elements.
  • <xs:element name="name" type="xs:string"/>is an element do define Person data type. It is named name and stored as a string.

Use XSD In XML Document

We can use the XSD or XML Definition in an XML document while exchanging or storing information. The following XML document uses the previously defined Person data type. We will just put some data into this Person object which are name, surname, age, and city.

Leave a Reply

Your email address will not be published. Required fields are marked *