Skip to content

Commit

Permalink
Backport #49
Browse files Browse the repository at this point in the history
  • Loading branch information
goetas authored Apr 29, 2019
1 parent 0a2fbab commit 4d90a53
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/SchemaReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,14 @@ private function loadElementRef(ElementDef $referenced, DOMElement $node)
if ($node->hasAttribute("minOccurs")) {
$ref->setMin((int)$node->getAttribute("minOccurs"));
}

$xp = new \DOMXPath($node->ownerDocument);
$xp->registerNamespace('xs', 'http://www.w3.org/2001/XMLSchema');

if ($xp->query('ancestor::xs:choice', $node)->length) {
$ref->setMin(0);
}

if ($node->hasAttribute("nillable")) {
$ref->setNil($node->getAttribute("nillable") == "true");
}
Expand Down

0 comments on commit 4d90a53

Please sign in to comment.