/// <summary>
    /// Extracts a collection of messages from the <see cref="HtmlValidationResult"/> object given by <paramref name="result"/> parameter.
    /// </summary>
    /// <param name="result">Results object</param>
    private IEnumerable <HtmlValidationMessage> GetMessages(HtmlValidationResult result)
    {
        if ((result == null) || (result.Messages == null))
        {
            return(Enumerable.Empty <HtmlValidationMessage>());
        }

        return(result.Messages);
    }
    /// <summary>
    /// Converts the <see cref="HtmlValidationResult"/> object to the <see cref="DataSet"/> in order to display it in the UniGrid.
    /// </summary>
    /// <param name="result">Results object</param>
    private DataSet GetDataSetFromResult(HtmlValidationResult result)
    {
        var ds = new DataSet();

        ds.CaseSensitive = false;
        var messages = GetMessages(result);

        if (messages.Any())
        {
            var table = new DataTable();

            table.Columns.AddRange(new[]
            {
                new DataColumn("type"),
                new DataColumn("line", typeof(Int32)),
                new DataColumn("column", typeof(Int32)),
                new DataColumn("message"),
                new DataColumn("source"),
                new DataColumn("highlightStart", typeof(Int32)),
                new DataColumn("highlightLength", typeof(Int32))
            });

            foreach (var message in messages)
            {
                var row = table.NewRow();

                row.ItemArray = new object[]
                {
                    message.Type,
                    (message.FirstLine == 0) ? message.LastLine : message.FirstLine,
                    (message.FirstColumn == 0) ? message.LastColumn : message.FirstColumn,
                    message.Message,
                    message.Extract,
                    message.HiliteStart,
                    message.HiliteLength
                };

                table.Rows.Add(row);
            }

            ds.Tables.Add(table);
        }

        return(ds);
    }