Difference between revisions of "Using Validate Tool"

From The SBN Wiki
Jump to navigation Jump to search
(Safety Save)
(Safety Save)
Line 15: Line 15:
  
 
These options have been grouped by functional areas.  All options have both a short and a long form. One or two hyphens can be used for both short and long options interchangeably; long options ''cannot'' be truncated.  Most options require arguments, but even those that do not can ''not'' be globbed.  That is, specifying "''-Vh''" will display only version information, not help information.
 
These options have been grouped by functional areas.  All options have both a short and a long form. One or two hyphens can be used for both short and long options interchangeably; long options ''cannot'' be truncated.  Most options require arguments, but even those that do not can ''not'' be globbed.  That is, specifying "''-Vh''" will display only version information, not help information.
 +
 +
=== Program Information ===
  
 
{| class="wikitable"
 
{| class="wikitable"
| style="width: 10%" | '''Option'''
+
| style="width: 15%" | '''Option'''
| style="width: 15%" align="center" | '''Argument'''
+
| style="width: 20%" align="center" | '''Argument'''
 
| '''Notes'''
 
| '''Notes'''
 
|-
 
|-
| colspan="3" | '''''Program Information'''''
+
| -V, -version
|-
+
| align="center" | ''--none--''
| style="width: 15%" | -V, -version
 
| style="width: 15%" align="center" | ''--none--''
 
 
| This option displays the internal code version, the release date, and the core schemas applied by default by this version of ''validate'', in addition to some licensing boilerplate.
 
| This option displays the internal code version, the release date, and the core schemas applied by default by this version of ''validate'', in addition to some licensing boilerplate.
 
|-
 
|-
| style="width: 15%" | -h, -help
+
| -h, -help
| style="width: 15%" align="center" | ''--none--''
+
|align="center" | ''--none--''
 
| This option displays a command and option summary.  It's about 50 lines long, so prepare to scroll.
 
| This option displays a command and option summary.  It's about 50 lines long, so prepare to scroll.
 +
|}
 +
 +
=== Selecting What to Validate ===
 +
{| class="wikitable" style="background-color: yellow"
 +
| '''Note:''' ''No merging or duplicate removal is done on the list of files and directories supplied.  If the list, when expanded, includes the same file or directory more than once, that element will be validated ''in its entirety'' each time it is listed.  This is a waste of time - potentially a significant one for large file collections.
 +
|}
 +
 +
{| class="wikitable"
 +
| style="width: 15%" | '''Option'''
 +
| style="width: 20%" align="center" | '''Argument'''
 +
| '''Notes'''
 
|-
 
|-
| colspan="3" | '''''File Selection'''''
+
| -t, -target
 +
| align="center" | ''file/directory list''
 +
| Use this option as an alternate way to specify which files and/or directories (i.e., "targets") to validate.  In the absence of the '''-t''' option, the comma-separated list of targets ''must'' immediately follow the ''validate'' command.  By using the option, the target list can appear at any point among the other options.  The syntax and globbing options are identical whether the '''-t''' switch is used or not. It is possible to provide two target lists: one with the '''-t''' option, and one without.  In this case the two lists are concatenated, and any options the modify file selection apply to the merged list.
 
|-
 
|-
| colspan="3" | '''''Output Control'''''
+
| -L, -local
 +
| align="center" | ''--none--''
 +
| Note the uppercase "L" in the short version of this option.  When present, this option prevents ''validate'' from recursing down into subdirectories of any directories included in the argument list or '''-t''' target list.
 
|-
 
|-
| colspan="3" | '''''Specifying Schemas'''''
+
| -e, -regexp
|-
+
| align="center" | ''pattern[, pattern]''
| colspan="3" | '''''Additional Validation'''''
+
| This option appears to be misnamed.  It does not accept regular expressions in general, but rather allows an addition option for file-globbing beyond what might be in the argument or target list.  It is applied only to the file name, not the path, and behaves as if anchored to the beginning and end of the file name. So '''-e "*.XML"''' will select only files with the explicit uppercase "XML" extension. 
|-
+
 
| colspan="3" | '''''Configuration File'''''
+
Beware of selecting files by name without extension.  The option '''-e "table*"''' will select all files beginning with "table" regardless of file extension - most likely producing a validation error when ''validate'' attempts to validate data files as well as labels.
 +
|}
 +
 
 +
=== Output Control ===
 +
 
 +
{| class="wikitable"
 +
| style="width: 15%" | '''Option'''
 +
| style="width: 20%" align="center" | '''Argument'''
 +
| '''Notes'''
 +
|}
 +
 
 +
=== Specifying Schemas ===
 +
 
 +
{| class="wikitable"
 +
| style="width: 15%" | '''Option'''
 +
| style="width: 20%" align="center" | '''Argument'''
 +
| '''Notes'''
 +
|}
 +
 
 +
=== Additional Validation ===
 +
 
 +
{| class="wikitable"
 +
| style="width: 15%" | '''Option'''
 +
| style="width: 20%" align="center" | '''Argument'''
 +
| '''Notes'''
 +
|}
 +
 
 +
=== Configuration File ===
 +
 
 +
{| class="wikitable"
 +
| style="width: 15%" | '''Option'''
 +
| style="width: 20%" align="center" | '''Argument'''
 +
| '''Notes'''
 
|}
 
|}
 +
 +
== Common Errors ==
 +
 +
'''''ERROR  Uncaught exception while validating: Input file is not a directory: ...'''''
 +
 +
This is usually caused by a typo in you command (or configuration file).  Look at the name of the "file" for a clue.  This can be caused by a mistyped long option as well as mistyped file or directory names.

Revision as of 22:32, 27 May 2017

The Validate tool is the canonical PDS4 validator for single labels, collections, and bundles. It provides additional functionality beyond schematic development, and advanced features are still in active development.

If you haven't already installed and configured Validate, you'll find instructions on the Installing and Configuring Validate Tool page on this wiki, as well as included in the download bundle.

Format

The general command format is:

% validate [files] [options]

"Files" can be a single label file name, a directory, or a comma-separated list of both. This list may include absolute and relative paths, wild cards, and file globs. Alternately, the product labels to be validated can be specified as arguments to the -t option.

By default, if validate is given a directory as an argument it will attempt to validate all files ending in either ".xml" or ".XML" with the selected options, and will recurse down through all subdirectories doing the same.

Command Line Options

These options have been grouped by functional areas. All options have both a short and a long form. One or two hyphens can be used for both short and long options interchangeably; long options cannot be truncated. Most options require arguments, but even those that do not can not be globbed. That is, specifying "-Vh" will display only version information, not help information.

Program Information

Option Argument Notes
-V, -version --none-- This option displays the internal code version, the release date, and the core schemas applied by default by this version of validate, in addition to some licensing boilerplate.
-h, -help --none-- This option displays a command and option summary. It's about 50 lines long, so prepare to scroll.

Selecting What to Validate

Note: No merging or duplicate removal is done on the list of files and directories supplied. If the list, when expanded, includes the same file or directory more than once, that element will be validated in its entirety each time it is listed. This is a waste of time - potentially a significant one for large file collections.
Option Argument Notes
-t, -target file/directory list Use this option as an alternate way to specify which files and/or directories (i.e., "targets") to validate. In the absence of the -t option, the comma-separated list of targets must immediately follow the validate command. By using the option, the target list can appear at any point among the other options. The syntax and globbing options are identical whether the -t switch is used or not. It is possible to provide two target lists: one with the -t option, and one without. In this case the two lists are concatenated, and any options the modify file selection apply to the merged list.
-L, -local --none-- Note the uppercase "L" in the short version of this option. When present, this option prevents validate from recursing down into subdirectories of any directories included in the argument list or -t target list.
-e, -regexp pattern[, pattern] This option appears to be misnamed. It does not accept regular expressions in general, but rather allows an addition option for file-globbing beyond what might be in the argument or target list. It is applied only to the file name, not the path, and behaves as if anchored to the beginning and end of the file name. So -e "*.XML" will select only files with the explicit uppercase "XML" extension.

Beware of selecting files by name without extension. The option -e "table*" will select all files beginning with "table" regardless of file extension - most likely producing a validation error when validate attempts to validate data files as well as labels.

Output Control

Option Argument Notes

Specifying Schemas

Option Argument Notes

Additional Validation

Option Argument Notes

Configuration File

Option Argument Notes

Common Errors

ERROR Uncaught exception while validating: Input file is not a directory: ...

This is usually caused by a typo in you command (or configuration file). Look at the name of the "file" for a clue. This can be caused by a mistyped long option as well as mistyped file or directory names.