/********************************************************************** * METS Java Toolkit * Copyright (c) 2002 by the President and Fellows of Harvard College * * The METS specification was developed as an initiative of the * Digital Library Federation and is * maintained by the Network Development and MARC Standards Office of * the Library of Congress . * The toolkit is compliant with the JAXB API specification, copyright * (c) 2001 Sun Microsystems, Inc. . * The toolkit uses the XP parser, copyright (c) 1997,1998 James Clark * . **********************************************************************/ import java.io.*; import org.mets.xml.marshal.*; import org.mets.xml.mets.*; /** * Test procedural unmarshalling and validation of a METS file using * the METS Java toolkit, based on the JAXB binding framework API. * * @author Stephen Abrams * @version 1.0 (alpha) 2002/03/15 */ public class Unmarshal { /****************************************************************** * PRIVATE CLASS FIELDS. ******************************************************************/ private static final int BUFFER_SIZE = 8192; /****************************************************************** * APPLICATION MAIN ENTRY POINT. ******************************************************************/ public static void main (String [] args) { if (args.length < 1) { System.err.println ("usage: java Unmarshal file"); System.exit (-1); } try { FileInputStream fs = new FileInputStream (args[0]); BufferedInputStream in = new BufferedInputStream (fs, BUFFER_SIZE); Mets mets = Mets.unmarshal (in); mets.validate (); mets.marshal (System.out); fs.close (); } catch (Exception e) { System.err.println ("Exception: " + e.getMessage ()); e.printStackTrace (); } } }