fix(schema): hold an attributeGroup reference to (annotation?) content (#145)
A referencing attributeGroup (one with a ref) names a definition elsewhere; its own content model is (annotation?), so it may not also declare attributes, nested attributeGroup references, or an anyAttribute. Only a defining attributeGroup (with a name) carries those. XSTS invalid-schemas-accepted 210 to 207, no other bucket moved.
This commit is contained in:
parent
709d23cc34
commit
d402732d23
@ -22,6 +22,8 @@ Second pre-release. Continues the W3C XSTS schema-validity campaign: **invalid-s
|
||||
|
||||
### Fixed
|
||||
|
||||
- XSTS invalid-schemas-accepted (#145): a referencing `attributeGroup` (one carrying a `ref`) is held to its `(annotation?)` content model. It names a definition elsewhere, so it may not itself declare attributes, nested attributeGroup references, or an `anyAttribute`; only a defining `attributeGroup` (with `name`) carries those (`attgD`). Caught three invalid schemas: invalid-schemas-accepted 210 → 207, no other bucket moved.
|
||||
|
||||
- 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.
|
||||
|
||||
@ -169,7 +169,16 @@ extension PureXML.Schema.XSDParser {
|
||||
return errors
|
||||
}
|
||||
|
||||
static func attributeGroupChildrenErrors(_: XSDTree, names: [String]) -> [String] {
|
||||
static func attributeGroupChildrenErrors(_ node: XSDTree, names: [String]) -> [String] {
|
||||
// A referencing attributeGroup (one with `ref`) names a definition elsewhere;
|
||||
// its own content model is (annotation?), so it may not also declare
|
||||
// attributes, nested attributeGroup references, or an anyAttribute. Only a
|
||||
// defining attributeGroup (with `name`) carries those.
|
||||
if PureXML.Schema.XSDNode.attribute(node, "ref") != nil {
|
||||
return names.contains { $0 != "annotation" }
|
||||
? ["an attributeGroup reference may contain only an optional annotation"]
|
||||
: []
|
||||
}
|
||||
var errors: [String] = []
|
||||
let anyAttributes = names.count { $0 == "anyAttribute" }
|
||||
if anyAttributes > 1 {
|
||||
|
||||
@ -113,8 +113,12 @@ struct XSTSSuiteTests {
|
||||
/// 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.
|
||||
/// Holding a referencing `attributeGroup` (one with `ref`) to its `(annotation?)`
|
||||
/// content model, so it may not also declare attributes, nested attributeGroup
|
||||
/// references, or an anyAttribute, then caught three more invalid schemas:
|
||||
/// invalid-schemas accepted 210 → 207, no other bucket moved.
|
||||
private let knownSchemaValidRejected = 1
|
||||
private let knownSchemaInvalidAccepted = 210
|
||||
private let knownSchemaInvalidAccepted = 207
|
||||
private let knownInstanceValidRejected = 3
|
||||
private let knownInstanceInvalidAccepted = 132
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user