diff --git a/schemas/w3c/xmlschema/2001/notation.json b/schemas/w3c/xmlschema/2001/notation.json new file mode 100644 index 0000000..7555ea8 --- /dev/null +++ b/schemas/w3c/xmlschema/2001/notation.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "W3C XML Schema NOTATION", + "description": "Represents the NOTATION attribute type from XML 1.0 (§3.2.16). The value space of NOTATION is the set of QNames of notations declared in the current schema. The lexical space consists of QName strings that reference notation declarations. Note that the semantic constraint requiring the QName to reference an actual notation declaration in the schema cannot be validated in isolation by this schema", + "examples": [ "jpeg", "png", "gif", "svg", "mime:image-jpeg", "format:pdf" ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ + "https://www.w3.org/TR/xmlschema-2/#NOTATION", + "https://www.w3.org/TR/2000/REC-xml-20001006#NT-NotationType" + ], + "$ref": "qname.json" +} diff --git a/test/w3c/xmlschema/2001/notation.test.json b/test/w3c/xmlschema/2001/notation.test.json new file mode 100644 index 0000000..6ccac3e --- /dev/null +++ b/test/w3c/xmlschema/2001/notation.test.json @@ -0,0 +1,149 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/w3c/xmlschema/2001/notation.json", + "tests": [ + { + "description": "Valid - simple unprefixed notation name", + "data": "jpeg", + "valid": true + }, + { + "description": "Valid - unprefixed notation name", + "data": "png", + "valid": true + }, + { + "description": "Valid - unprefixed with hyphen", + "data": "image-jpeg", + "valid": true + }, + { + "description": "Valid - unprefixed with dot", + "data": "text.plain", + "valid": true + }, + { + "description": "Valid - unprefixed with underscore", + "data": "video_mpeg", + "valid": true + }, + { + "description": "Valid - prefixed notation name", + "data": "mime:image-jpeg", + "valid": true + }, + { + "description": "Valid - prefixed with namespace", + "data": "format:pdf", + "valid": true + }, + { + "description": "Valid - prefixed with uppercase", + "data": "MIME:JPEG", + "valid": true + }, + { + "description": "Valid - prefixed complex name", + "data": "media.type:application-xml", + "valid": true + }, + { + "description": "Valid - single character", + "data": "x", + "valid": true + }, + { + "description": "Valid - Unicode notation name", + "data": "图像", + "valid": true + }, + { + "description": "Valid - prefixed Unicode", + "data": "类型:图像", + "valid": true + }, + { + "description": "Invalid: empty string", + "data": "", + "valid": false + }, + { + "description": "Invalid: starts with digit", + "data": "123format", + "valid": false + }, + { + "description": "Invalid: starts with hyphen", + "data": "-format", + "valid": false + }, + { + "description": "Invalid: contains space", + "data": "image jpeg", + "valid": false + }, + { + "description": "Invalid: contains tab", + "data": "image\tjpeg", + "valid": false + }, + { + "description": "Invalid: multiple colons", + "data": "mime:type:jpeg", + "valid": false + }, + { + "description": "Invalid: colon at start", + "data": ":jpeg", + "valid": false + }, + { + "description": "Invalid: colon at end", + "data": "jpeg:", + "valid": false + }, + { + "description": "Invalid: contains special character", + "data": "image@jpeg", + "valid": false + }, + { + "description": "Invalid: prefix starts with digit", + "data": "123mime:jpeg", + "valid": false + }, + { + "description": "Invalid: local part starts with digit", + "data": "mime:123jpeg", + "valid": false + }, + { + "description": "Type validation: not a string (number)", + "data": 123, + "valid": false + }, + { + "description": "Type validation: not a string (boolean)", + "data": true, + "valid": false + }, + { + "description": "Type validation: not a string (null)", + "data": null, + "valid": false + }, + { + "description": "Type validation: not a string (array)", + "data": [ "mime", "jpeg" ], + "valid": false + }, + { + "description": "Type validation: not a string (object)", + "data": { + "prefix": "mime", + "localPart": "jpeg" + }, + "valid": false + } + ] +}