Click here to Skip to main content
15,897,273 members
Articles / Programming Languages / XML

Validating data with Flat File Checker

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
30 Oct 2009GPL32 min read 43.8K   881   17  
An article on data validation with a flat file schema generated in Flat File Checker.
Imports System.Xml
Imports System.Xml.XPath

Public Class DuplicateRecordsCollection
    Inherits RecordsCollection
    ''' <summary>
    ''' Line number of the record in the file
    ''' </summary>
    ''' <remarks></remarks>
    Private _master_row As Integer
    Private _action As MergeRows
    Private _column_replacements As List(Of Replacement)
    ''' <summary>
    '''  Colection of duplicate records (line numbers of rows)
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub New(ByVal row As Integer, ByVal action As MergeRows)
        MyBase.New(row)
        _master_row = row
        _action = action
        _column_replacements = New List(Of Replacement)


    End Sub
    Public Property MasterRow() As Integer
        Get
            Return _master_row
        End Get
        Set(ByVal value As Integer)
            _master_row = value
        End Set
    End Property
    Public Sub ReplaceValues()
        _column_replacements = New List(Of Replacement)
        Dim proc As MergeProcessor
        For Each proc In Me._action.MergeProcessors
            Me._column_replacements.Add(New Replacement(proc.Column, proc.GetValue(Me)))
        Next
    End Sub
    Public ReadOnly Property Replacements() As ICollection(Of Replacement)
        Get
            Return Me._column_replacements
        End Get
    End Property
End Class

Public Class Replacement
    Private _column As DataColumn
    Private _value As String
    Friend ReadOnly Property Column() As DataColumn
        Get
            Return _column
        End Get
    End Property
    Friend ReadOnly Property Value() As String
        Get
            Return _value
        End Get
    End Property
    Public Sub New(ByVal column As DataColumn, ByVal value As String)
        _column = column
        _value = Value
    End Sub
End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Database Developer
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions