@Test
public void testExportSchema()
                throws Exception {

    String schemaURL = this.getClass().getResource( "../cite/schema/cite-gmlsf0.xsd" ).toURI().toString();
    GMLSchemaInfoSet gmlSchemaInfoSet = new GMLSchemaInfoSet( null, schemaURL );
    GMLAppSchemaReader adapter = new GMLAppSchemaReader( GMLVersion.GML_31, null, schemaURL );
    AppSchema schema = adapter.extractAppSchema();
    XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
    outputFactory.setProperty( XMLOutputFactory.IS_REPAIRING_NAMESPACES, true );
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    XMLStreamWriter writer = new IndentingXMLStreamWriter( outputFactory.createXMLStreamWriter( os ) );
    GMLAppSchemaWriter encoder = new GMLAppSchemaWriter( GMLVersion.GML_31, "http://cite.opengeospatial.org/gmlsf",
                                                         null, schema.getNamespaceBindings() );
    encoder.export( writer, gmlSchemaInfoSet, "http://cite.opengeospatial.org/gmlsf", uri -> uri );
    writer.close();
    System.out.println( os.toString() );
}