public class CsvValidator
extends java.lang.Object
A typical invocation sequence:
Boolean failFast = false; List<Substitution> pathSubstitutions = new ArrayList<Substitution>(); //add a substitution path pathSubstitutions.add(new Substitution("file://something", "/home/xxx")); List<FailMessage> messages = CsvValidator.validate( "/home/dev/IdeaProjects/csv/csv-validator/csv-validator-core/data.csv", "/home/dev/IdeaProjects/csv/csv-validator/csv-validator-core/data-schema.csvs", failFast, pathSubstitutions, true); if(messages.isEmpty()) { System.out.println("All worked OK"); } else { for(FailMessage message : messages) { if(message instanceof WarningMessage) { System.out.println("Warning: " + message.getMessage()); } else { System.out.println("Error: " + message.getMessage()); } } }
| Constructor and Description |
|---|
CsvValidator() |
| Modifier and Type | Method and Description |
|---|---|
static java.util.List<FailMessage> |
validate(java.io.Reader csvData,
java.io.Reader csvSchema,
boolean failFast,
java.util.List<Substitution> pathSubstitutions,
java.lang.Boolean enforceCaseSensitivePathChecks,
java.lang.Boolean trace)
Validate CSV data against a CSV schema
|
static java.util.List<FailMessage> |
validate(java.io.Reader csvData,
java.io.Reader csvSchema,
boolean failFast,
java.util.List<Substitution> pathSubstitutions,
java.lang.Boolean enforceCaseSensitivePathChecks,
java.lang.Boolean trace,
ProgressCallback progress)
Validate CSV data against a CSV schema
|
static java.util.List<FailMessage> |
validate(java.lang.String csvFilename,
java.nio.charset.Charset csvEncoding,
java.lang.String csvSchemaFilename,
java.nio.charset.Charset csvSchemaEncoding,
boolean failFast,
java.util.List<Substitution> pathSubstitutions,
java.lang.Boolean enforceCaseSensitivePathChecks,
java.lang.Boolean trace)
Validate a CSV file against a CSV schema file
|
static java.util.List<FailMessage> |
validate(java.lang.String csvFilename,
java.nio.charset.Charset csvEncoding,
java.lang.String csvSchemaFilename,
java.nio.charset.Charset csvSchemaEncoding,
boolean failFast,
java.util.List<Substitution> pathSubstitutions,
java.lang.Boolean enforceCaseSensitivePathChecks,
java.lang.Boolean trace,
ProgressCallback progress)
Validate a CSV file against a CSV schema file
|
static java.util.List<FailMessage> |
validate(java.lang.String csvFilename,
java.lang.String csvSchemaFilename,
boolean failFast,
java.util.List<Substitution> pathSubstitutions,
java.lang.Boolean enforceCaseSensitivePathChecks,
java.lang.Boolean trace)
Validate a CSV file against a CSV schema file
Assumes that the encoding of the CSV file and
CSV Schema file are both UTF-8
|
static java.util.List<FailMessage> |
validate(java.lang.String csvFilename,
java.lang.String csvSchemaFilename,
boolean failFast,
java.util.List<Substitution> pathSubstitutions,
java.lang.Boolean enforceCaseSensitivePathChecks,
java.lang.Boolean trace,
ProgressCallback progress)
Validate a CSV file against a CSV schema file
Assumes that the encoding of the CSV file and
CSV Schema file are both UTF-8
|
public static java.util.List<FailMessage> validate(java.lang.String csvFilename, java.lang.String csvSchemaFilename, boolean failFast, java.util.List<Substitution> pathSubstitutions, java.lang.Boolean enforceCaseSensitivePathChecks, java.lang.Boolean trace)
csvFilename - filename of the CSV filecsvSchemaFilename - Filename of the CSV schema filefailFast - true if you want to stop processing on the first error found,
false if you want to fine all errorspathSubstitutions - list of substitutions for file pathsenforceCaseSensitivePathChecks - Enforces case-sensitive file path checkstrace - When set to true, a trace of the grammar parse will be outputpublic static java.util.List<FailMessage> validate(java.lang.String csvFilename, java.nio.charset.Charset csvEncoding, java.lang.String csvSchemaFilename, java.nio.charset.Charset csvSchemaEncoding, boolean failFast, java.util.List<Substitution> pathSubstitutions, java.lang.Boolean enforceCaseSensitivePathChecks, java.lang.Boolean trace)
csvFilename - filename of the CSV filecsvEncoding - The charset encoding used in the CSV filecsvSchemaFilename - Filename of the CSV schema filecsvSchemaEncoding - The charset encoding used in the CSV Schema filefailFast - true if you want to stop processing on the first error found,
false if you want to fine all errorspathSubstitutions - list of substitutions for file pathsenforceCaseSensitivePathChecks - Enforces case-sensitive file path checkstrace - When set to true, a trace of the grammar parse will be outputpublic static java.util.List<FailMessage> validate(java.lang.String csvFilename, java.lang.String csvSchemaFilename, boolean failFast, java.util.List<Substitution> pathSubstitutions, java.lang.Boolean enforceCaseSensitivePathChecks, java.lang.Boolean trace, ProgressCallback progress)
csvFilename - filename of the CSV filecsvSchemaFilename - Filename of the CSV schema filefailFast - true if you want to stop processing on the first error found,
false if you want to fine all errorspathSubstitutions - list of substitutions for file pathsenforceCaseSensitivePathChecks - Enforces case-sensitive file path checkstrace - When set to true, a trace of the grammar parse will be outputprogress - A callback to receive progress updates on the validation
processpublic static java.util.List<FailMessage> validate(java.lang.String csvFilename, java.nio.charset.Charset csvEncoding, java.lang.String csvSchemaFilename, java.nio.charset.Charset csvSchemaEncoding, boolean failFast, java.util.List<Substitution> pathSubstitutions, java.lang.Boolean enforceCaseSensitivePathChecks, java.lang.Boolean trace, ProgressCallback progress)
csvFilename - filename of the CSV filecsvEncoding - The charset encoding used in the CSV filecsvSchemaFilename - Filename of the CSV schema filecsvSchemaEncoding - The charset encoding used in the CSV Schema filefailFast - true if you want to stop processing on the first error found,
false if you want to fine all errorspathSubstitutions - list of substitutions for file pathsenforceCaseSensitivePathChecks - Enforces case-sensitive file path checkstrace - When set to true, a trace of the grammar parse will be outputprogress - A callback to receive progress updates on the validation
processpublic static java.util.List<FailMessage> validate(java.io.Reader csvData, java.io.Reader csvSchema, boolean failFast, java.util.List<Substitution> pathSubstitutions, java.lang.Boolean enforceCaseSensitivePathChecks, java.lang.Boolean trace)
csvData - CSV datacsvSchema - CSV schemafailFast - true if you want to stop processing on the first error found,
false if you want to fine all errorspathSubstitutions - list of substitutions for file pathsenforceCaseSensitivePathChecks - Enforces case-sensitive file path checkstrace - When set to true, a trace of the grammar parse will be outputpublic static java.util.List<FailMessage> validate(java.io.Reader csvData, java.io.Reader csvSchema, boolean failFast, java.util.List<Substitution> pathSubstitutions, java.lang.Boolean enforceCaseSensitivePathChecks, java.lang.Boolean trace, ProgressCallback progress)
csvData - CSV datacsvSchema - CSV schemafailFast - true if you want to stop processing on the first error found,
false if you want to fine all errorspathSubstitutions - list of substitutions for file pathsenforceCaseSensitivePathChecks - Enforces case-sensitive file path checkstrace - When set to true, a trace of the grammar parse will be outputprogress - A callback to receive progress updates on the validation
processCopyright © 2013-2021 The National Archives. All Rights Reserved