XML Schema help you modeling (1) Author: Xiao Chai Road www.ASPCool.com
XML Schema is a recommended standard for W3C (World Wide Web Alliance), officially released in May 2001. After several years of large-scale discussions and development, it is now laid, and it is the preferred data modeling tool in the world's recognized XML environment. Since XML is a subset of SGML (standard universal label language), it also inherits SGML for modeling DTD. The advantage of using DTD is to take advantage of a large number of existing DTD tools, making it a relatively low level to develop applications. However, DTD has a lot of defects: 1. DTD is based on regular expressions, and the description ability is limited; 2. DTD has no data type support, in most application environments; 3. DTD constraint definition ability is insufficient, unable Detailed semantic restrictions on the XML instance document; 4. DTD is not structured, the cost of reuse is relatively high; 5. DTD is not using XML as a description method, and the construction of DTD does not have a standard programming interface, cannot be DTD maintenance is performed using standard programming. XML Schema is designed for the shortcomings of these DTDs, which use XML as a descriptor, which has strong description capabilities, extension capabilities, and processing maintenance. XML Schema Introduction The main purpose of XML Schema is to define a class XML document (an XML Application). Therefore, the "example document" form of the mode is often used to describe an XML document consistent with a particular XML Schema. In fact, document instances and Schema documents do not exist in the form of documents, which can exist in the form of byte streams transmitted between applications, or as a collection of database records and XML "information items". However, in order to simplify the entry, we always regard examples and patterns as documentation or files, think they always exist in the form of a document instance or a mode document. Here we will combine an example to make a simple summary of XML Schema, I hope that you can use the usage method for the initial master of this section and the specific semantics of the XML Schema document instance. XML Schema is a basic tool for web services technology, but not all features of XML Schema will be used extensively, and therefore, this article will not be introduced for the system of XML Schema. Before introducing the XML Schema syntax, first consider an XML instance document PO.xml. It describes a home product purchase order generated by home product procurement / payment applications (see Code 1).
XML Version = "1.0"?>
An instance document actually does not necessarily need a reference mode document. Of course, in fact, many instance documents do reference the mode document, in order to make the entry make it simpler, and we choose not to reference. At the same time, it is assumed that the processor of any instance document does not receive any information from the purchase order instance document, and can also correctly purchase the order mode document. Purchase Order Mode Documents in Code 2, give the mode document for purchasing orders. Document PO.xSD Before giveing an explanation, you can use XML knowledge to try to understand this mode document.