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

11

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

  • What is the difference between the two?

  • Is it possible to work with an XML without an XSD?

asked by anonymous 30.06.2015 / 15:56

2 answers

8

Both files use the XML syntax. The difference is that XSD is used to validate an XML , what fields the XML should contain, what its types, whether they are mandatory or not , among others.

There are other answers to complement here .

    
30.06.2015 / 16:11
7

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

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

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

In case of integration of a strongly typed system, if the programmer is based on an XML that came without Birthdate to create their classes, you will be unfortunate when you begin to see XMLs containing Birthdate.

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

    
30.06.2015 / 22:18