We can convert a XML file to XSD online easily. Several free online tools are available in the market.
I have used below URL to convert:
https://www.liquid-technologies.com/online-xml-to-xsd-converter
Suppose you have below employee XML:
<?xml version="1.0" encoding="UTF-8" ?>
<Employees>
<Employee>
<FirstName>Sanddy</FirstName>
<LastName>Das</LastName>
<Department>IT</Department>
<Qualification>BTECH</Qualification>
<Age>35</Age>
</Employee>
<Employee>
<FirstName>Dips</FirstName>
<LastName>Chak</LastName>
<Department>IT</Department>
<Qualification>MCA</Qualification>
<Age>34</Age>
</Employee>
<Employee>
<FirstName>Rupesh</FirstName>
<LastName>Sil</LastName>
<Department>HR</Department>
<Qualification>MBA</Qualification>
<Age>42</Age>
</Employee>
</Employees>
Converted XSD:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Employees">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Employee">
<xs:complexType>
<xs:sequence>
<xs:element name="FirstName" type="xs:string" />
<xs:element name="LastName" type="xs:string" />
<xs:element name="Department" type="xs:string" />
<xs:element name="Qualification" type="xs:string" />
<xs:element name="Age" type="xs:unsignedByte" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>