private void generateScheme ( final File filename , final Document root ) throws DITAOTException { final File p = filename . getParentFile ( ) ; if ( ! p . exists ( ) && ! p . mkdirs ( ) ) { throw new DITAOTException ( "Failed to make directory " + p . getAbsolutePath ( ) ) ; } Result res = null ; try { res = new StreamResult ( new FileOutputStream ( filename ) ) ; final DOMSource ds = new DOMSource ( root ) ; final TransformerFactory tff = TransformerFactory . newInstance ( ) ; final Transformer tf = tff . newTransformer ( ) ; tf . transform ( ds , res ) ; } catch ( final RuntimeException e ) { throw e ; } catch ( final Exception e ) { logger . error ( e . getMessage ( ) , e ) ; throw new DITAOTException ( e ) ; } finally { try { close ( res ) ; } catch ( IOException e ) { throw new DITAOTException ( e ) ; } } }
Serialize subject scheme file .