Validating MODS

From UA Libraries Digital Services Planning and Documentation
Jump to: navigation, search

When you run to generate MODS from your tab-delimited UTF8 spreadsheet, the script will generate a manifest.xml file in the directory where the spreadsheet is located. It will be named for the spreadsheet, for example: u0001_2011012.12.m01.txt will have a manifest named u0001_2011012.12.manifest.xml. For remediated MODS, see the manifestMods script to create the manifest used in XMLSpy. In this file are links to each of the MODS files, so:


1) Right click on this XML file and select to open it with XMLSpy. For this to work, see XMLSpy settings at the bottom of this page.

2) At the top of the XMLSpy window, click on XSL/XQuery and select XSL Transformation from the top of the dropdown list


3) XMLSpy will read the manifest (which contains a list of identifiers and links to each MODS file) and will test each one against the MODS_full_check.xsl in S:\\Metadata\Code\Schematron\. It will also validate each file.

4) When it has finished, an XSL Output.txt file will pop up with notes of problems found with each identifier (if no notes follow the identifier -- and the MODS file isn't listed at the bottom saying it's not valid, it's fine.)


5) Also when it has finished, if any of the MODS failed to validate, that will show up in the bottom center window of XMLSpy, with a message such as:

  File:S\Digital Projects\Completed\u0002_0000006_0001993.mods.xml is not valid
  Reason:  The following elements are expected at this location(see below)

a) If this happens, either there was something unexpected or missing in the spreadsheet -- or something happened with the script.

b) Review the spreadsheet to look for what might be different

c) Contact someone who maintains this script.

6) If XMLSpy hangs, it's usually due to a non-UTF8 character in one of the files. When it hangs, a window will pop up that says "MODS_Schematron.xsl" at the top, and in the window at the bottom of the XMLSpy screen, you'll see a message such as

 "Cannot retrieve resource file:///S/:/Digital Projects/Completed/u0002_0000006/Metadata/MODS/u0002_0000006_0002011.mods.xml" 


a) open the offending MODS file in XMLSpy. You will get a message such as "Your file contains 1 character(s) that should not be present in a file using the Unicode UTF-8 encoding. If you proceed, these characters will be replaced by a substitution character in the document window. Do you wish to continue opening the document?"


b) Click "OK".

c) Save the file and close it.

d) Close the Schematron window.

e) Go back to Step 2 above and continue.

7) When validation is complete, and all errors corrected, Metadata Librarians are ready to move the collection directory containing jpegs, MODS, and spreadsheet files (EXCEL, UTF.txt, and manifest) to Digital Projects folder named "Return_To-Digital_Services." Digital Services will move content and MODS to the server.

  • For the validation to work in xmlSpy, review the XSL tab under Tools>Options. The first item must be checked, "Built-in RaptorXML XSLT engine..." and check box to "Validate XML files used in transformation." Default file extension of output file is .xml, check box to "Reuse output window", and check box "Use file extension from <xsl:output method=""> attribute if provided."