function serializeTypeDef($type)
    {
        //print "in sTD() for type $type<br>";
        if ($typeDef = $this->getTypeDef($type)) {
            $str .= '<' . $type;
            if (is_array($typeDef['attrs'])) {
                foreach ($typeDef['attrs'] as $attName => $data) {
                    $str .= " $attName=\"{type = " . $data['type'] . "}\"";
                }
            }
            $str .= " xmlns=\"" . $this->schema['targetNamespace'] . "\"";
            if (count($typeDef['elements']) > 0) {
                $str .= ">";
                foreach ($typeDef['elements'] as $element => $eData) {
                    $str .= $this->serializeTypeDef($element);
                }
                $str .= "</$type>";
            } elseif ($typeDef['typeClass'] == 'element') {
                $str .= "></$type>";
            } else {
                $str .= "/>";
            }

            return $str;
        }

        return FALSE;
    }