public static void write ( final Hml data , final Writer writer ) throws IOException { checkNotNull ( data ) ; checkNotNull ( writer ) ; try { JAXBContext context = JAXBContext . newInstance ( Hml . class ) ; Marshaller marshaller = context . createMarshaller ( ) ; SchemaFactory schemaFactory = SchemaFactory . newInstance ( XMLConstants . W3C_XML_SCHEMA_NS_URI ) ; URL schemaURL = HmlReader . class . getResource ( "/org/nmdp/ngs/hml/xsd/hml-1.0.1.xsd" ) ; Schema schema = schemaFactory . newSchema ( schemaURL ) ; marshaller . setSchema ( schema ) ; marshaller . setProperty ( Marshaller . JAXB_FORMATTED_OUTPUT , true ) ; marshaller . marshal ( data , writer ) ; } catch ( JAXBException | SAXException e ) { e . printStackTrace ( ) ; throw new IOException ( "could not marshal HML" , e ) ; } }
Write the specified HML to the specified writer .