1. XML constraint rules
a) A collection of elements that appear on the topmost element.
b) Collection of each element, a valid attribute, and nested elements.
c) Provide default values if the property is omitted for each optional attribute of an element.
d) The order of the equivalent element is allowed on the top and any nested layers.
e) On the top and any nested layer, an element requirement and the number of occurrences allowed.
f) For each element, it can contain unconstitutional text (called "cdata").
2. Data type list:
3. Value space
a) SERIALIZATION SPACE: The content stored in the document is stored. (Actual storage)
b) parse Space: Document content represented by Unicode. (Standard storage)
c) LEXical Space: The representation of the document content. (Indicate value)
d) Value Space: The actual value of the document content. (Actual value)
example:
1.0 b>
Suppose the type , is Decimal
S space
P Space
L Space
V Space
1.00
31 2e 30 30
00 31 00 2e 00 30 00 30
1.00
1
1.0
31 2e 30
00 31 00 2e 00 30
1.0
1
4. Space processing
a) Spaceization Space -> Parsed Space
Refers to a space with all Tabs (# x9), wrap (#xa), and carriage return (# x20).
b) space folding (PARSED SPACE -> Lexical Space)
Refers to deleting spaces located at the beginning and end position, and merge all neighboring spaces into a space.
5. Data type
All data types are represented by a third group (Value Space, Lexical Space, Facets).
6. String type branch:
a) Structure diagram:
b) Overview:
Mainly used to represent data related to strings, this part is generally considered to be disorderless. The String type is the base class of this part, and he is the only type without space replacement and space folding. NormalizedString is a type indicating a space replacement without a space folding, which is used to indicate the type of space folding through a space. These three types are not used to characterize a particular type. When a particular type is required, you can use the more specific subclass of Token, for example, language can be used when a language is required, and Name can be used when a certain name is required, and the ID can be used when it is necessary to indicate the ID value. When it is necessary to indicate a definitive name with a name space, QNAME, etc. can be used.
7. Numeric type branch:
a) Structure diagram:
b) Overview:
Mainly used to represent the concepts related to the value, this part of the data is generally in an orderly manner. Where float and double are used to represent the floating point of the IEEE 754 standard. Decimal is a digital base class, he can represent any form of numbers, and Integer mainly represents a positive number. By adding different Facet to Integer to limit his value space, we can get other specific subclasses. 8. Time type branch:
a) Structure diagram:
b) Overview:
Most of the type of time is a semi-organized type, and it is different from the above two types, which is mainly not interactive and extended, but it is expanded from the basic type. Where Duration is used to represent the concept of a time period, he is used to describe a span of a time, while other types are concepts for a time point for describing a particular point in time.
9. Custom type
In addition to the built-in type, we can also customize type definitions through the extended mechanism provided by Schema. The expansion mechanism includes the following:
a) restriction
Create a new type by constraining the Value Space of the base class.
I. Syntax:
Base = Qname ID = ID {any attributes with non-schema namespace..}> Content: (Annotation ?, (MINEXCLUSIVE | MININCLUSIVE | MAXEXCLUSIVE | MAXINCLUSIVE | TOTALDIGITS | FRACTIONDIGITS | Length | MINLENGTH | MAXLENGTH | ENUMERATION | Whitespace | Pattern) *)) restriction> Ii. Example: Schema: restriction> simpletype> XML:
b) list Used to indicate a list consisting of a certain type. Specify via the ItemType property. I. Syntax: ID = ID ItemType = QNAME {any attributes with non-schema namespace..}> Content: (Annotation ?, simpleType?) list> Ii. Example: Schema: XML: 1.0 2.0 3.1 (correct) 1.0 32 (error) c) union It is used to represent a combination of a variety of types. I. Syntax: ID = ID MEMBERTYPES = List of qname {any attributes with non-schema namespace..}> Content: (Annotation ?, simpleType *) union> Ii. Example: Schema: xsd: restriction> xsd: SimpleType> xsd: restriction> xsd: SimpleType> xsd: union> xsd: SimpleType> XML: a header font> (correct) this is a test font> (error) 10. Facet Elements used to constrain the value space in the Restriction are called "facet". Each basic type specifies the Facet collection he can use. For details, you can refer to the DataTypes section of the Schema specification. In addition, when we expand from a type through Restriction, the same Facet may be used between the parent, the subtype, and the SCHEMA has different requirements according to the difference in Facet. a) further constraints of Facet For Enumeration, FractionDigits, MaxExClusive, MaxInClusive, Maxlength, MinexClusive, MININCLUSIVE, MINEXCLUSIVE, MININCLUSIVE, MINLENGTH, and TOTALDIGITS, if we define the same Facet as the parent type in the subtype, we can only further constrain, namely The defined Value Space must be a subset of the parent type. For example, the following is an error example because the Value Space of the subtype is not a subset of the parent type Value Space. xs: restriction> xs: simpletype> xs: restriction> xs: simpletype> b) Facet cannot be modified For Length, the subtype does not allow the Length value defined by the parent type. c) Facet of the intersection of the value For Pattern, when the FACET is defined when the FACET is defined, the values of the two Pattern will be used. d) Special Facet For general Facet, they are used to constrain Value Space, while Whitespace is the only special case. The Facet's role is before lexical space, so he is the only Facet that may extend Lexical Space. E.g: xs: restriction> xs: simpletype> xs: restriction> xs: simpletype> Greetings type can accept How do you do ?, but will reject how do you do? because he did not appear in the enumeration. But Restrict-Greetings can accept the latter, because he can make a space for HOW do you do? Before lexical space, it becomes how do you do ?. e) define the Facet of fixed properties In addition to Enumeration and Pattern, all other Facets have a "fixed" attribute. When the value of this attribute is True, the subtype will no longer modify the value of the framet.
simpletype>