private function loadAttributeGroup(Schema $schema, DOMElement $node) { $attGroup = new AttributeGroup($schema, $node->getAttribute("name")); $attGroup->setDoc($this->getDocumentation($node)); $schema->addAttributeGroup($attGroup); return function () use($schema, $node, $attGroup) { foreach ($node->childNodes as $childNode) { switch ($childNode->localName) { case 'attribute': if ($childNode->hasAttribute("ref")) { $attribute = $this->findSomething('findAttribute', $schema, $node, $childNode->getAttribute("ref")); } else { $attribute = $this->loadAttribute($schema, $childNode); } $attGroup->addAttribute($attribute); break; case 'attributeGroup': $attribute = $this->findSomething('findAttributeGroup', $schema, $node, $childNode->getAttribute("ref")); $attGroup->addAttribute($attribute); break; } } }; }