People who have used XML know that the syntax can be validated using a DTD (Document Type Definition), but Microsoft dominates the XML Schema for the next generation of validation syntax, and it is unified. Just look at a few changes around us and see.
Web.xml from Web-app_2_3.dtd to Web-app_2_4.xsd
Spring configuration files from Spring-beans.dtd to Spring-beans-2.0.dtd to spring-beans-2.0.xsd until flexible custom schemas
Quartz_jobs.xml configuration file from Job_scheduling_data_1_5.dtd to Job_scheduling_data_1_5.xsd
Introduction to XML schemas
An XML Schema is a validation technique that has a more detailed description of syntax than a DTD, and is itself an XML file, unlike DTDs, which are unique syntax. Since XML schemas and DTDs are used to validate XML, and to grab the limelight, there is something to be commended for. So let's talk about the shortcomings of DTDs and the characteristics of XML schemas.
1 The DTD uses its own syntax, and the XML Schema itself is an XML piece that avoids learning new syntax.
2 The DTD has very limited support for data types, and #PCDATA, and XML schemas can support strings, integers, floating-point numbers, Boolean values, time, dates, and so on.
3 The DTD supports structural definitions that are too inflexible to represent? (0 or one), * (0 or more), + (one or more), but powerless for {m,n} like regular expressions, and XML schemas have minoccur and maxoccur to control the number of child elements that occur.
4 The DTD belongs to a closed architecture, that is, all tags and attributes to be used in all XML files must be declared in the DTD before they can be used. XML Schemas adopt an open architecture and do not require that all elements and attributes in XML must be declared and reused first.
5 An XML DTD will be used for an entire XML file, not a part of the XML file to specify a different DTD. The XML schema can specify a different schema for individual elements, and the smallest cutting unit can be a tag.
This is what we see in the web.xml of the application DTD to write on the front <! DOCTYPE Web-app public ... web-app_2_3.dtd ", it works with the entire document.
Note that the Web.xml,shema applied to XML Shema is a property specified as Web-app, <web-app xsi:schemalocation= "... web-app_2_4.xsd", and other elements can be specified separately XML Schema.
6 XML Schema because it is an XML file, you can dynamically modify the syntax rules through the DOM, and the DTD does not. In addition, the XML Schema Extension also allows additional information to be added to assist in descriptive data.
7 The XML Schema uses namespaces and is therefore extensible. This is significant in the Spring 2.x configuration file, supporting custom XML schemas such as the introduction of Spring-aop-2.0.xsd and Spring-tx-2.0.xsd, respectively, <aop:config> and <tx:ad Vice> and so on.
The basics of XML schemas
Although the XML Schema was first proposed by Microsoft and has been accepted and reviewed by the consortium, it still derives two standards for MS and the consortium. Microsoft's XML Schema version is called XDR (XML Data reduced), the schema extension is "xml", and the XML Schema version of the consortium is called an XSD (XML Schema Definition) or XSDL (XML Schema Definition Language) with the extension "XSD". And I am mainly in the Java camp, the basic use of XSD, look at our new Web.xml and spring configuration files used in the XSD file, so the use of the standard to introduce the XML Schema.
XML can use DTDs or schemas internally or externally, but for external DTDs it is <! Doctype> specified, while the external schema,xml is to be aided by namespaces. Such as
<programming_team xmlns="x-schema:schema1.xml">
<programmer>Fred Samson</programmer>
</programming_team>