Harvard University Library - Library Digital Initiative
  Home 
  METS 
  JAXB 
  Toolkit 
  Procedural Construction 
  Validation 
  Marshalling / Unmarshalling 
  Implementation 
  Papers and Presentations 
 
  Printer-Friendly Version of Site 

  Harvard University Library 
 
  Office for Information Systems 
 
  Library Digital Initiative 

METS Java Toolkit / Marshalling / Unmarshalling
Draft Version 1.0 (alpha) 2002/03/15

The procedure to marshal a METS file is to create an in-memory representation composed of instantiated objects, and invoke the root <mets> class validate() and marshal() methods:

Mets mets = new Mets ();
...

mets.validate ();
mets.marshal (outputStream);

This generates a well-formed and valid METS file on the output stream.

The procedure to unmarshal a METS file to an in-memory representation is to instantiate the root <mets> class, and invoke its unmarshal() and validate() methods:

Mets mets = Mets.unmarshal (inputStream);
mets.validate ();
...

At this point, the entire document is represented by a tree structure of instantiated objects, against which the standard accessor and mutator functions can be invoked.


Stephen Abrams
Harvard University Library, Office for Information Systems
1280 Massachusetts Avenue, Suite 404
Cambridge, MA 02138
stephen_abrams@harvard.edu
Copyright © 2002 by the President and Fellows of Harvard College.
This information about the METS Java Toolkit is provided for evaluation purposes only.

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 © 2001 Sun Microsystems, Inc.
The toolkit uses the XP parser, copyright © 1997,1998 James Clark.