question: String writeConfigFileV2 ( MatsimConfigType matsimConfigType ) throws UncheckedIOException { try { String destination = this . dummyPath + "/test_config.xml" ; BufferedWriter bw = IOUtils . getBufferedWriter ( destination ) ; String xsdPath = TempDirectoryUtil . createCustomTempDirectory ( "xsd" ) ; LoadFile loadFile = new LoadFile ( InternalConstants . V2_MATSIM_4_URBANSIM_XSD_MATSIMORG , xsdPath , InternalConstants . V2_XSD_FILE_NAME ) ; File file2XSD = loadFile . loadMATSim4UrbanSimXSD ( ) ; if ( file2XSD == null || ! file2XSD . exists ( ) ) { log . error ( "Did not find xml schema!" ) ; System . exit ( 1 ) ; } log . info ( "Using following xsd schema: " + file2XSD . getCanonicalPath ( ) ) ; SchemaFactory schemaFactory = SchemaFactory . newInstance ( XMLConstants . W3C_XML_SCHEMA_NS_URI ) ; Schema schema = schemaFactory . newSchema ( file2XSD ) ; JAXBContext jaxbContext = JAXBContext . newInstance ( ObjectFactory . class ) ; Marshaller m = jaxbContext . createMarshaller ( ) ; m . setSchema ( schema ) ; m . setProperty ( Marshaller . JAXB_FORMATTED_OUTPUT , Boolean . TRUE ) ; JAXBElement elem = new JAXBElement ( new QName ( "" , "matsim_config" ) , MatsimConfigType . class , matsimConfigType ) ; m . marshal ( elem , bw ) ; return destination ; } catch ( JAXBException e ) { e . printStackTrace ( ) ; Assert . assertFalse ( true ) ; } catch ( SAXException e ) { e . printStackTrace ( ) ; Assert . assertFalse ( true ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; Assert . assertFalse ( true ) ; } return null ; }
target:  writes the MATSim4UrbanSim confing at the specified place using JAXB