mirror of
https://github.com/MariaDB/server.git
synced 2026-10-23 18:49:29 +03:00
A schema type that refers to itself, directly or through other types or groups, was validated with a single shared compositor state per type. A nested use of the type reset the state of the outer one, so XMLISVALID() gave wrong results for recursive schemas. Now every recursion level of an XMLSchema_user_type gets its own copy of the type's content (get_copy()/copy_tags()). Copies are kept on a per-type stack while validating, and released copies are put in m_c_free and reused, so memory doesn't grow with each validated row. reset_types() unwinds any state left by a validation that aborted. Other changes: - XMLSchema_item::is_validate_done() is replaced with ::end_validation(st). It is no longer a pure check: it pops the compositor stack and must be paired with validate_prepare(). - validate_prepare() can now fail, and the failure is propagated. - A recursion depth limit (MAX_RECURSION_DEPTH, 1024) is added, counted per type. When it is hit, or on OOM during validation, XMLISVALID() returns errors/warnings. - XMLSchema_group_def now derives from XMLSchema_user_type, so groups get the same copy mechanism. As a side effect <xs:group final=...> is accepted. - XMLSchema_group_reference now counts occurrences, so minOccurs and maxOccurs of a group reference are enforced. - XMLSchema_group_def::check_type() checks for circular groups, and XMLSchema_attribute::check_type() is removed (named types and groups are checked globally). - The circular-reference error names the construct: "complexType B has bad circular references" instead of "type B has ...". The affected .result lines are re-recorded. - Hook chains (m_next_tag) are replaced with List<> because tags are now copied.