XML and Perl
Use your favorite text editor to open fix-ead.pl. Notice how it combines the process_files subroutine of the previous example with the SAX event-driven parser to loop through a set of files in one directory, reading the files' data, setting and unsetting flags, and outputting results to a second directory. Fix the EAD files in xml-data/ead/broken and save them to xml-data/ead/fixed using this command: bin/ fix-ead.pl /lamp/xml-data/ead/broken/ /lamp/xml-data/ead/fixed/ . Use xmllint to selectively validate the newly created EAD files against the workbook's version of the EAD DTD.