From cd4475f90dea8c592d6c1487e8bd3110e02c4678 Mon Sep 17 00:00:00 2001 From: Christoph Hochholzer Date: Tue, 17 Mar 2026 13:40:43 +0100 Subject: [PATCH] fix(YamlConverter): respect form="unqualified" on individual elements in getElementNamespace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a schema has elementFormDefault="qualified" but an individual element explicitly declares form="unqualified", getElementNamespace incorrectly assigned a namespace to that element via the $schema->getElementsQualification() OR branch, overriding the element's own correct isQualified()=false result. The XÖV/XÖV-Standard xoev-code pattern relies on this distinction: all code/name child elements are declared form="unqualified" for cross-schema interoperability, even when the containing schema uses elementFormDefault="qualified". The fix removes $schema->getElementsQualification() from the condition entirely. $element->isQualified() already incorporates the schema-level default as a fallback when no explicit form attribute is present, so the removed condition was both redundant and incorrect. Reproducer: any XSD where elementFormDefault="qualified" and a local element has form="unqualified"; before this fix the generated JMS YAML metadata would include an erroneous namespace entry for that element. --- src/Jms/YamlConverter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Jms/YamlConverter.php b/src/Jms/YamlConverter.php index 5266920..a5f785e 100644 --- a/src/Jms/YamlConverter.php +++ b/src/Jms/YamlConverter.php @@ -468,10 +468,10 @@ public function getPropertyInHierarchy($class, $prop) * * @return string|null */ - protected function getElementNamespace(Schema $schema, ElementItem $element) + protected function getElementNamespace(Schema $_schema, ElementItem $element) { if ($element->getSchema()->getTargetNamespace() && - ($schema->getElementsQualification() || ($element instanceof Element && $element->isQualified()) || !$element->isLocal()) + (($element instanceof Element && $element->isQualified()) || !$element->isLocal()) ) { return $element->getSchema()->getTargetNamespace(); }