Rules File

The rules file specifies which tests TIFF Validation performs. It is in an XML format. A general form is shown here:
<?xml version="1.0"?>
<tiffValidation>
   <image>
      <test tiffHeaderRequired="Y/N" suspect="Y/N"></test>
      <test byteOrder="little/big" suspect="Y/N"></test>
      <test IFD="valid" suspect="Y/N"></test>
      <test tagOrder="ascending" suspect="Y/N"></test>
      <test page="single" suspect="Y/N"></test>
      <test pointers="valid" suspect="Y/N"></test>
      <test decompress="G4Only" suspect="Y/N"></test>
      <test decompressLength="G4Only" suspect="Y/N"></test>
      <test EOFB="G4Only" suspect="Y/N"></test>
      <test extraPadLimit="G4Only" suspect="Y/N">numBytes</test>
   </image>

   <tag number="n" name="FieldName">
      <test mandatory="Y" suspect="Y/N"></test>
      <test field="type/count" suspect="Y/N">v1 v2 v3 ...</test>
      <test operator="EQ/NEQ" suspect="Y/N">v1 v2 v3 ...</test>
      <test operator="EQ/NEQ" tagNumber="n" suspect="Y/N"></test>
      [more <test> elements]
   </tag>

   [more <tag> elements]
</tiffValidation>

Most tests can be omitted. When the image test to ensure the TIFF data starts with a TIFF header (tiffHeaderRequired) and the TIFF image file directory structure test (IFD) are omitted from the rules, TIFF Validation still performs the tests.

Table 1 lists the available keywords, values, and descriptions for the rules file.

Table 1. Rules File Keywords
Keyword Value Description
tiffValidation   The root element of a TIFF Validation rules file
image   Contains the group of image tests to perform
test v1 v2 v3 Specifies a test or validation rule to perform. For tests that have values, include a space-separated list of up to 16 numbers.
tiffHeaderRequired Y, N An image test that verifies the TIFF data starts with a TIFF header. When set to Y or when the test is omitted, the header must be present to pass. When set to N, TIFF Validation reports missing headers with no failures or other test results.
suspect Y, N Controls output for a test that does not pass. When set to Y or when the attribute is omitted, TIFF Validation generates a failure in the result of the test. When set to N, it generates a warning in the result.
byteOrder little, big Image test that verifies the TIFF data byte order is little or big endian.
IFD valid Image test that verifies the TIFF image file directory (IFD) structure. The IFD and its referenced data must lie within the TIFF data. TIFF Validation always performs this test.
tagOrder ascending Image test that verifies the TIFF fields appear in ascending tag order. All fields in the first IFD, including fields that are not specified in the rules, are tested. It fails if two fields have the same tag number.
page single Image test that verifies the TIFF data contains a single image or page. This means a single IFD.
pointers valid Image test that verifies that the TIFF header and the first IFD do not reference the same TIFF data from more than one place.
decompress G4Only Image test that validates G4 compressed data. It parses the compressed bit stream in the image data. It passes when the compressed G4 data complies with the ITU-T Recommendation T.6 base coding scheme, which defines the coding that is used in the Group 4 facsimile. TIFF validation does not consider extensions, such as uncompressed mode, valid.
decompressLength G4Only Image test that verifies the image length that is specified in the TIFF header matches the number of scan lines present in the compressed G4 data. It parses the compressed bit stream in the image data. It passes when the image length in the header matches the number of G4 compressed scan lines.
EOFB G4Only Image test that verifies that the Group 4 compressed bilevel images have an EOFB bit sequence.
extraPadLimit G4Only Image test that verifies the maximum number of full padding bytes the Group 4 compressed bilevel images might have beyond the EOFB bit sequence. TIFF Validation allows numbers zero to 16 for this keyword.
tag   Contains a group of tag tests to perform. Add one for each TIFF field to be tested.
number n Attribute that is the decimal integer TIFF tag number for the TIFF field to test.
name FieldName This attribute is the name of the TIFF field to test. The name appears in the output.
mandatory Y Tag test that states a TIFF field be present. Y is the only accepted value. If a TIFF field is optional, omit this test. It is the only tag test that produces output when a TIFF field is absent.
field type Tag test that verifies the TIFF field type equals one of a list of specified numbers. The field type number represents the data type of the field.
count Tag test that verifies the TIFF field count equals one of a list of specified numbers. The field count is the number of values in the field.
operator EQ Tag test that verifies that the first field value equals one of a list of specified numbers.
NEQ Tag test that verifies that the first field value does not equal one of a list of specified numbers.
tagnumber n This attribute serves as a field reference for operator tests. It is the decimal integer tag number of another TIFF field to use in the comparison. Use this in place of the list of numbers. It verifies that the first field value equals or does not equal the value of another TIFF field.
invalidTag   Tag test that detects if the specified tag is present. If it is, the test generates a failure result.