public function toValue($type = null, $valueAttribute = null)
    {
        $value = ($valueAttribute)? (string)$this[$valueAttribute] : (string)$this;
        $type = ($type)?: (string)$this['type'];

        switch ($type) {
            case 'int':
                $value = (int)$value;
                break;

            case 'float':
                $value = (float)$value;
                break;

            case 'bool':
                $value = $this->_toBoolean($value);
                break;

            case 'double':
                $value = (double)$value;
                break;

            case 'null':
                $value = null;
                break;

            case 'array':
                $value = $this->toArray(true);
                break;
        }

        return $value;
    }