Read and enforce the XSD 1.0 derivation controls that were previously ignored: - abstract elements may not appear in an instance directly, only through a substitution member; an element of an abstract complex type must supply an xsi:type naming a concrete derived type. - block on a type forbids the disallowed xsi:type substitutions; block on an element drops substitution-group members that derive by a blocked method. - final on a type rejects, at compile time, any type that derives from it by a final method. - xs:redefine requires the redefined type to derive from itself. Track each named complex type's base and derivation method as the backbone these checks walk. Also compose complexContent extension and restriction content models, which were previously dropped: an extension now inherits its base's attributes and content (base first, then the extension, in sequence). Complex-type restriction is not verified to be a structurally valid subset of its base (Particle Valid (Restriction)); that limit is documented at its sites. Closes #76
11 lines
416 B
Swift
11 lines
416 B
Swift
public extension PureXML.Schema {
|
|
/// A way one type is derived from another, or one element substitutes for
|
|
/// another: by extension, by restriction, or (for elements) by substitution
|
|
/// group membership. Used by the `block` and `final` derivation controls.
|
|
enum DerivationMethod: Sendable, Equatable, Hashable {
|
|
case `extension`
|
|
case restriction
|
|
case substitution
|
|
}
|
|
}
|