Repository navigation
🐛 fix(xsd): check ID and g* lexical forms - #2185
Merged
Merged
Conversation
The built-in datatype table had no entries for ID, IDREF, ENTITY, NOTATION, gYear, gYearMonth, gMonth, gMonthDay and gDay. A schema that named one of them fell back to xs:string, so XMLSchema and RelaxNG accepted any text for it. Both engines resolve built-in names through that table, so the nine types now get their XSD 1.0 lexical checks there: NCName for ID, IDREF and ENTITY, QName for NOTATION, and the Part 2 forms for the g* date types. The name list that kept these types as string fallbacks drops them.
Merging this PR will not alter performance
Comparing Footnotes
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Schemas that name
ID,IDREF,ENTITY,NOTATIONor one of theg*date types accepted any text for those values, because the engine had no lexical check for them. 🧾 Once this merges, a value outside the XSD 1.0 form fails with adatatypeerror, in both XML Schema and RELAX NG validation. Fixes #2159.The built-in datatype table had no entry for these nine names, so each one fell back to
xs:string. The table now has an entry for each, and each entry routes to its lexical check: an NCName check forID,IDREFandENTITY, a QName check forNOTATION, and a check of the reduced date form for eachg*type (XSD 1.0 Part 2,gYear). The RELAX NG<data>element that uses the XSD datatype library reads the same table, so both validators share one rule set.Behavior changes
datatypeerror, for XML Schema element and attribute types, types derived from them, and RELAX NG<data>with the XSD datatype library.g*types stay unchecked, because the engine has no ordering for those types.