コード例 #1
0
 private function loadExtension(BaseComplexType $type, DOMElement $node)
 {
     $extension = new Extension();
     $type->setExtension($extension);
     if ($node->hasAttribute("base")) {
         $parent = $this->findSomething('findType', $type->getSchema(), $node, $node->getAttribute("base"));
         $extension->setBase($parent);
     }
     foreach ($node->childNodes as $childNode) {
         switch ($childNode->localName) {
             case 'sequence':
             case 'choice':
             case 'all':
                 $this->loadSequence($type, $childNode);
                 break;
             case 'attribute':
                 if ($childNode->hasAttribute("ref")) {
                     $attribute = $this->findSomething('findAttribute', $type->getSchema(), $node, $childNode->getAttribute("ref"));
                 } else {
                     $attribute = $this->loadAttribute($type->getSchema(), $childNode);
                 }
                 $type->addAttribute($attribute);
                 break;
             case 'attributeGroup':
                 $attribute = $this->findSomething('findAttributeGroup', $type->getSchema(), $node, $childNode->getAttribute("ref"));
                 $type->addAttribute($attribute);
                 break;
         }
     }
 }
コード例 #2
0
ファイル: PhpConverter.php プロジェクト: goetas/xsd2php
 private function visitBaseComplexType(PHPClass $class, BaseComplexType $type)
 {
     $parent = $type->getParent();
     if ($parent) {
         $parentType = $parent->getBase();
         if ($parentType instanceof Type) {
             $this->handleClassExtension($class, $parentType);
         }
     }
     $schema = $type->getSchema();
     foreach ($type->getAttributes() as $attr) {
         if ($attr instanceof AttributeGroup) {
             $this->visitAttributeGroup($class, $schema, $attr);
         } else {
             $property = $this->visitAttribute($class, $schema, $attr);
             $class->addProperty($property);
         }
     }
 }
コード例 #3
0
ファイル: YamlConverter.php プロジェクト: goetas/xsd2php
 private function visitBaseComplexType(&$class, &$data, BaseComplexType $type, $name)
 {
     $parent = $type->getParent();
     if ($parent) {
         $parentType = $parent->getBase();
         if ($parentType instanceof Type) {
             $this->handleClassExtension($class, $data, $parentType, $name);
         }
     }
     $schema = $type->getSchema();
     if (!isset($data["properties"])) {
         $data["properties"] = array();
     }
     foreach ($this->flattAttributes($type) as $attr) {
         $data["properties"][$this->getNamingStrategy()->getPropertyName($attr)] = $this->visitAttribute($class, $schema, $attr);
     }
 }