// create an instance of XML Schema marshaller
AbstractMarshaller marshaller = (AbstractMarshaller)Marshaller.FACTORY.getInstance();
// we need to specify what elements are top most (roots) providing namespace URI, prefix and local name
marshaller.addRootElement("http://example.org/ns/books/", "", "book");
// declare default namespace
marshaller.declareNamespace(null, "http://example.org/ns/books/");
// add schema location by declaring xsi namespace and adding xsi:schemaReader attribute