XML technical lecture five

xiaoxiao2021-03-06  87

The origin and development of Schema

DTD acts as an important part of the XML 1.0 specification that plays a good description of the structure of the XML document. However, it also has some shortcomings, for example, it uses non-XML grammar rules, not supporting data type, poor scalability, and more. Schema just solved these problems. Overall, Schema has the following advantages:

Consistency: Schema makes the definition of XML without having to use a specific formal language, but directly with the characteristics of XML itself, using XML's basic symptom rules, so that XML reaches from within The perfect unity of the outside is also a solid foundation for the further development of XML.

Schenometry: Schema has expanded DTD, introduced data type, named space, thereby enabling it to extend more scalability.

Interchangeability: Using Schema, we can write XML documents and verify the legality of the document. In addition, through a particular mapping mechanism, different SCHEMAs can be converted to achieve higher levels of data exchange.

Normative: Like DTD, Schema also provides a complete mechanism to restrict the use of the target in the XML document, but in contrast, the latter is based on XML, more normative. Schema uses the content and attributes of the element to define the overall structure of the XML document, such as which elements can appear in the document, what is the relationship between the elements, what content and attributes and attributes of each element, and the order and number of elements, etc. It can be a lot.

Schema syntax

Schema has a complete set of syntax, the key elements involved include: Schema, ElementType, Element, AttributeType, Attribute, Group, Datatype, Description. (Note: Real as Blue this with the SCHEMA of Microsoft IE 5)

The schema element is the first element in XML Schema, which is used to declare that the XML document is an SCHEMA document. Schema has two properties: name specifies the name of the schema, and XMLNs specifies the namespace containing the schema.

The ElementType element is one of the important elements in XML Schema to define an element that appears in the XML Schema document. By the attribute content, it indicates whether the element declared by ElementType is empty, whether the text contains the sub-elements, or both text but also the sub-elements, specify the data type of the element via the order of the element, by order The alignment of the elements, the corresponding values ​​are: One, SEQ, MANY. The element element is used to declare an element that appears in ElementType, which needs to be used with ElementType.

AttributeType elements are used to define attribute types that appear in the Schema document. Its property DT: Type Specifies the data type of the declared attribute type, supportable data types include: Entity, Entities, Enumeration, ID, IDREF, IDREFS, NMTOKEN, NMTOKENS, NOTATION, and STRING. The DEFAULT property can be used to specify the default value of the attribute type. The Required property specifies whether this property is required to reference it. Attribute elements are actually a reference to attributeType declaration, which also requires use with AttributeType.

Group elements are used to group elements in the XML document. The order of elements or sub-packets in the packet can specify the order of the elements or sub-packets in the packet, specify the minimum and maximum number of times that appears in the XML instance document, respectively.

DataType is an important element in XML Schema and a major feature of XML Schema, which is used to specify data types for ElementType and AttributeType. XML Schema supports two data types: Ten basic data types defined in XML 1.0 standards and some extension data types. Description can only be regarded as a supporting role in XML Schema, and its main role is to provide description information for ElementType and AttributeType elements.

Schema application

Due to the advantages of XML Schema, the SCHEMA replaces DTD has become trend. In this case, the internationally renowned enterprises and organization auditations have tilted XML Schema in the strategy, providing support for XML Schema. The most typical of the most typical is certainly Microsoft's BizTalk and XML.org organization registration / repository. More worth mentioning, Microsoft took the lead in providing support for Schema in its browser software Internet Explorer 5.0, of course, because the final XML Schema standard has not officially launched, so Microsoft's SCHEMA is only transitional "standard", in the future It will continue to be modified. (See website www.cnw.com.cn, please

转载请注明原文地址:https://www.9cbs.com/read-122061.html

New Post(0)