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->setIsAComplexType(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()); } } if ($this->getAttribute('mixed') == 'true') { $generator->setMixed(true); } $content = $this; // Should only be one $this->generateComplexType($content, $generator, $element_context); 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; }
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; }
function &generate($element_context, &$global_elements) { $element_context[] = $this->getAttribute("name"); print implode(",", $element_context) . "\n"; // Get new factory $generator = new ElementMeta($global_elements); // 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); $subGroup = $this->getAttribute('substitutionGroup'); if ($subGroup != '') { //print "found a subGroup ". $subGroup ."!\n"; $generator->setSubstitutionGroup($subGroup); $generator->bag['ref_elements'][] = $subGroup; } $abstract = $this->getAttribute('abstract'); if ($abstract != '') { $generator->setAbstract($abstract); } // 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()); } $ap = $a[0]->getElementsByType('xsAppinfo'); if (count($ap) > 0) { $generator->setAppInfo($ap[0]->get()); } } //******************************************************************************************/ //$generator->setContentType( $this->getAttribute( 'type' ) ); $type = $this->getAttribute('type'); $generator->bag['base_type'] = $type; //check if this type equals a complex type //print "element ". $this->getAttribute( 'name' ) ." is of type ". $type ."!\n"; if ($type != "") { //print "complex types: " . count($GLOBALS['_globals']['complex_types']) . "\n"; for ($i = 0; $i < count($GLOBALS['_globals']['complex_types']); $i++) { if (!strcmp($type, $GLOBALS['_globals']['complex_types'][$i]->getAttribute('name'))) { //print "found a match for ". $type ."\n"; $generator->setComplexType(true); $generator->bag['ref_elements'][] = $type; break; } } if (!$generator->bag['complex_type']) { //wasn't a complex type that means it needs a content type $generator->setContentType($type); } } //*******************************************************************************************/ // Inspect the semantic structure of this node and extract the elements/attributes $temp = $this->getElementsByType('xsComplexType'); if (count($temp) > 0) { if ($temp[0]->getAttribute('mixed') == 'true') { $generator->setMixed(true); $generator->setContentType('ListOfInts'); } $content = $temp[0]; // Should only be one $this->generateComplexType($content, $generator, $element_context); if (count($generator->bag['elements']) == 0) { $generator->setIsEmptyContent(true); } } else { if (count($this->getElementsByType('xsSimpleType')) > 0) { //inline simple type definition. right now handle as string but needs to be fixed $generator->bag['simple_type'] = new TypeMeta(); $temp = $this->getElementsByType('xsSimpleType'); $this->generateSimpleType($temp[0], $generator->bag['simple_type']); if (count($generator->bag['simple_type']->bag['enum']) > 0) { $generator->setContentType($this->getAttribute('name') . "_type"); } else { $generator->setContentType($generator->bag['simple_type']->bag['base']); } } } $meta =& $generator->getMeta(); if (count($element_context) == 1) { $global_elements[$element_context[0]] =& $meta; } return $meta; }