private void generate ( List < MetaTypeInformationSpecification > metatype ) { XMLOutputFactory factory = XMLOutputFactory . newInstance ( ) ; try { PrintWriter writer = new PrintWriter ( generatorOptions . getOutputFile ( ) , generatorOptions . getEncoding ( ) ) ; XMLStreamWriter xmlWriter = null ; if ( generatorOptions . getCompactOutput ( ) ) { xmlWriter = new CompactOutputXMLStreamWriter ( factory . createXMLStreamWriter ( writer ) ) ; } else { xmlWriter = new IndentingXMLStreamWriter ( factory . createXMLStreamWriter ( writer ) , writer ) ; } SchemaWriter schemaWriter = new SchemaWriter ( xmlWriter ) ; schemaWriter . setIgnoredPids ( generatorOptions . getIgnoredPids ( ) ) ; schemaWriter . setGenerateDocumentation ( true ) ; schemaWriter . setEncoding ( generatorOptions . getEncoding ( ) ) ; schemaWriter . setLocale ( generatorOptions . getLocale ( ) ) ; schemaWriter . setSchemaVersion ( generatorOptions . getSchemaVersion ( ) ) ; schemaWriter . setOutputVersion ( generatorOptions . getOutputVersion ( ) ) ; for ( MetaTypeInformationSpecification item : metatype ) { schemaWriter . add ( item ) ; } schemaWriter . generate ( true ) ; } catch ( RuntimeException e ) { throw e ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } }
Pass the constructed metatypinformation to SchemaWriter for the actual generation