What is the difference between an XML file and an XSD file?

Asked

Viewed 14,814 times

14

We know that these two types of files are correlated - .XSD e XML.

  • What’s the difference between the two?

  • What good is a .XML(Extensible Markup Language) and the .XSD?

  • It is possible to work with an XML without an XSD?

2 answers

10

The two files use the syntax of XML. The difference is that the XSD is used to validate a XML, what fields the XML should contain, among others, what their types are mandatory or not.

There are other answers to complement here.

9

XSD is the file that defines the data structure. XML is the file that contains the data. Yes it is possible to work with an XML without XSD, but it is recommended that you have an XSD.

For example, in XSD I can say that there is a field called Data_de_nascimento, which can be filled as null.

In the XML file if the Data_de_nascimento field is not filled in it may not be displayed.

In the case of integration of a strongly typed system, if the programmer relies on an XML that came without Data_de_nascimento to create his classes, he will have an unfortunate surprise when he starts coming Xmls containing Data_de_nascimento.

So to ensure the validity of the data as our colleague Daniel said, we use XSD, which many call Schema.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.