Ejemplo n.º 1
0
 function &generate($element_context, &$global_elements)
 {
     $element_context[] = $this->getAttribute("name");
     print implode(",", $element_context) . "\n";
     // Get new factory
     $generator = new ElementMeta($global_elements);
     $generator->setIsAGroup(true);
     // Load the class name and a context pre-fix (in case we're inside another element)
     $generator->setName($this->getAttribute('name'));
     $generator->setContext($element_context);
     // Extract any documentation for this node
     $a = $this->getElementsByType('xsAnnotation');
     if (count($a) > 0) {
         $d = $a[0]->getElementsByType('xsDocumentation');
         if (count($d) > 0) {
             $generator->setDocumentation($d[0]->get());
         }
     }
     // Inspect the semantic structure of this node and extract the elements/attributes
     $this->flatten($this, $generator, $element_context, $this->getAttribute('maxOccurs'));
     if (count($generator->bag['elements']) == 0) {
         $generator->setIsEmptyContent(true);
     }
     $meta =& $generator->getMeta();
     if (count($element_context) == 1) {
         $global_elements[$element_context[0]] =& $meta;
     }
     return $meta;
 }