// map publicId to systemId as it should appear in the resulting XML file
marshaller.mapPublicIdToSystemId("-//DTD Books//EN", "resources/xml/book/books.dtd");
// create an instance of ObjectModelProvider with the book instance to be marshalled
ObjectModelProvider provider = new BookGenericObjectModelProvider();
// marshal the book
marshaller.marshal(dtdReader, provider, book, xmlOutput);
// close DTD reader