public static function build( SimpleXMLElement $data)
    {
        $returnValue = null;

        
        $expression = null;
        $expressionName = $data->getName();
        
        //retrieve the expression attributes
        $attributes = array();
        foreach($data->attributes() as $key => $value){
            $attributes[$key] = (string)$value;
        }
        
        // Create expression function of its type (If specialization has been done for the expression type)
        $expressionClass = 'oat\\taoQtiItem\\model\\qti\\expression\\'.ucfirst($expressionName);
        
        if (class_exists($expressionClass)){
            $expression = new $expressionClass ($expressionName, $attributes);
        }
        else {
            $expression = new CommonExpression ($expressionName, $attributes);
        }
        
		// If the expression has a value
		$expressionValue = (string) trim($data);
		if ($expressionValue != ''){
			$expression->setValue($expressionValue);
		}
        
		// All sub-expressions of an expression are embedded by this expression
		$subExpressions = array();
		foreach ($data->children() as $subExpressionNode) {
			$subExpressions[] = self::build($subExpressionNode);
		}
		$expression->setSubExpressions($subExpressions);

        $returnValue = $expression;

        

        return $returnValue;
    }