fix(schema): include notation names in component-name uniqueness (#145)
A notation declaration occupies its own symbol space, so two notations sharing a name and target namespace are a duplicate just as two global types or elements would be. Notations were omitted from the uniqueness check. XSTS invalid-schemas-accepted 211 to 210, no other bucket moved.
This commit is contained in:
parent
616ec4876a
commit
709d23cc34
@ -22,6 +22,8 @@ Second pre-release. Continues the W3C XSTS schema-validity campaign: **invalid-s
|
||||
|
||||
### Fixed
|
||||
|
||||
- XSTS invalid-schemas-accepted (#145): notation names are now part of the component-name uniqueness check. A notation has its own symbol space, so two notations sharing a name and target namespace are a duplicate just as two global types or elements would be (`notatB005`). Caught one invalid schema: invalid-schemas-accepted 211 → 210, no other bucket moved.
|
||||
|
||||
- XSTS invalid-schemas-accepted (#145): an `xsd:notation` declaration is held to its `(annotation?)` content model. A notation may carry only an optional `annotation` child, so any other element child, or any non-whitespace character content, is now rejected (`notatG`). Caught three invalid schemas: invalid-schemas-accepted 214 → 211, no other bucket moved.
|
||||
|
||||
- XSTS invalid-schemas-accepted (#145): a `list` simple type must draw its item type from exactly one of an `itemType` attribute or an inline `simpleType` child (neither, or both, is invalid), and a `union` must declare at least one member type through a `memberTypes` attribute or an inline `simpleType` child (an empty `union` declares none), per `src-simple-type.2`/`.3`. Caught one invalid schema: invalid-schemas-accepted 215 → 214, no other bucket moved.
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
extension PureXML.Schema.XSDParser {
|
||||
/// Schema-validity findings for component-name uniqueness. Within a schema,
|
||||
/// global type names (simpleType and complexType share one symbol space),
|
||||
/// global element names, global attribute names, named model-group names, and
|
||||
/// named attribute-group names must each be unique; identity-constraint names
|
||||
/// global element names, global attribute names, named model-group names,
|
||||
/// named attribute-group names, and notation names must each be unique;
|
||||
/// identity-constraint names
|
||||
/// (unique/key/keyref) must be unique across the whole schema. A duplicate was
|
||||
/// accepted, with a later definition silently overwriting the earlier one.
|
||||
///
|
||||
@ -112,6 +113,7 @@ extension PureXML.Schema.XSDParser {
|
||||
case "attribute": "attribute"
|
||||
case "group": "group"
|
||||
case "attributeGroup": "attributeGroup"
|
||||
case "notation": "notation"
|
||||
default: nil
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,8 +109,12 @@ struct XSTSSuiteTests {
|
||||
/// (no element child other than an annotation, no non-whitespace character
|
||||
/// content) then caught three more invalid schemas: invalid-schemas accepted
|
||||
/// 214 → 211, no other bucket moved.
|
||||
/// Adding notations to the component-name uniqueness check (they have their own
|
||||
/// symbol space; two notations of the same name and namespace clash) then caught
|
||||
/// one more invalid schema: invalid-schemas accepted 211 → 210, no other bucket
|
||||
/// moved.
|
||||
private let knownSchemaValidRejected = 1
|
||||
private let knownSchemaInvalidAccepted = 211
|
||||
private let knownSchemaInvalidAccepted = 210
|
||||
private let knownInstanceValidRejected = 3
|
||||
private let knownInstanceInvalidAccepted = 132
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user