diff --git a/src/SchemaReader.php b/src/SchemaReader.php index a1bf4846..d4497503 100644 --- a/src/SchemaReader.php +++ b/src/SchemaReader.php @@ -417,6 +417,14 @@ private function loadSequenceChildNodeLoadElement( self::maybeSetMax($element, $childNode); self::maybeSetMin($element, $childNode); + + $xp = new \DOMXPath($node->ownerDocument); + $xp->registerNamespace('xs', 'http://www.w3.org/2001/XMLSchema'); + + if ($xp->query('ancestor::xs:choice', $childNode)->length) { + $element->setMin(0); + } + if ($childNode->hasAttribute('nillable')) { $element->setNil($childNode->getAttribute('nillable') == 'true'); }