protected function xmlizeOptions($formalOpts = array(), $recursive = false){
        $returnValue = (string) '';
        if(!is_array($formalOpts)){
            throw new InvalidArgumentException('formalOpts must be an array, '.gettype($formalOpts).' given');
        }

        $options = (!$recursive) ? $this->getAttributeValues() : $formalOpts;
        foreach($options as $key => $value){
            if(is_string($value) || is_numeric($value)){
                // str_replace is unicode safe...
                $returnValue .= ' '.$key.'="'.str_replace(array(
                            '&',
                            '<',
                            '>',
                            '\'',
                            '"'
                                ), array(
                            '&amp;',
                            '&lt;',
                            '&gt;',
                            '&apos;',
                            '&quot;'
                                ), $value).'"';
            }
            if(is_bool($value)){
                $returnValue .= ' '.$key.'="'.(($value) ? 'true' : 'false').'"';
            }
            if(is_array($value)){
                if(count($value) > 0){
                    $keys = array_keys($value);
                    if(is_int($keys[0])){ // repeat the attribute key
                        $returnValue .= ' '.$key.'="'.implode(' ', array_values($value)).'"';
                    }else{
                        $returnValue .= $this->xmlizeOptions($value, true);
                    }
                }
            }
        }

        return (string) $returnValue;
    }
protected function xmlizeOptions($formalOpts = array(), $recursive = false){
        $returnValue = (string) '';
        if(!is_array($formalOpts)){
            throw new InvalidArgumentException('formalOpts must be an array, '.gettype($formalOpts).' given');
        }

        $options = (!$recursive) ? $this->getAttributeValues() : $formalOpts;
        foreach($options as $key => $value){
            if(is_string($value) || is_numeric($value)){
                // str_replace is unicode safe...
                $returnValue .= ' '.$key.'="'.str_replace(array(
                            '&',
                            '<',
                            '>',
                            '\'',
                            '"'
                                ), array(
                            '&amp;',
                            '&lt;',
                            '&gt;',
                            '&apos;',
                            '&quot;'
                                ), $value).'"';
            }
            if(is_bool($value)){
                $returnValue .= ' '.$key.'="'.(($value) ? 'true' : 'false').'"';
            }
            if(is_array($value)){
                if(count($value) > 0){
                    $keys = array_keys($value);
                    if(is_int($keys[0])){ // repeat the attribute key
                        $returnValue .= ' '.$key.'="'.implode(' ', array_values($value)).'"';
                    }else{
                        $returnValue .= $this->xmlizeOptions($value, true);
                    }
                }
            }
        }

        return (string) $returnValue;
    }
protected function xmlizeOptions ( $ formalOpts = array ( ) , $ recursive = false ) { $ returnValue = ( string ) '' ; if ( ! is_array ( $ formalOpts ) ) { throw new InvalidArgumentException ( 'formalOpts must be an array, ' . gettype ( $ formalOpts ) . ' given' ) ; } $ options = ( ! $ recursive ) ? $ this -> getAttributeValues ( ) : $ formalOpts ; foreach ( $ options as $ key => $ value ) { if ( is_string ( $ value ) || is_numeric ( $ value ) ) { // str_replace is unicode safe... $ returnValue .= ' ' . $ key . '="' . str_replace ( array ( '&' , '<' , '>' , '\'' , '"' ) , array ( '&amp;' , '&lt;' , '&gt;' , '&apos;' , '&quot;' ) , $ value ) . '"' ; } if ( is_bool ( $ value ) ) { $ returnValue .= ' ' . $ key . '="' . ( ( $ value ) ? 'true' : 'false' ) . '"' ; } if ( is_array ( $ value ) ) { if ( count ( $ value ) > 0 ) { $ keys = array_keys ( $ value ) ; if ( is_int ( $ keys [ 0 ] ) ) { // repeat the attribute key $ returnValue .= ' ' . $ key . '="' . implode ( ' ' , array_values ( $ value ) ) . '"' ; } else { $ returnValue .= $ this -> xmlizeOptions ( $ value , true ) ; } } } } return ( string ) $ returnValue ; }
This method enables you to build a string of attributes for an xml node
from the Qti Element attributes according to their types.

@access protected
@author Sam, <sam@taotesting.com>
@param array formalOpts
@param boolean recursive
@return string
This method enables you to build a string of attributes for an xml node from the Qti Element attributes according to their types .