{
if (options==null)
options = new Inst2XsdOptions();
// create structure
TypeSystemHolder typeSystemHolder = new TypeSystemHolder();
XsdGenStrategy strategy;
switch (options.getDesign())
{
case Inst2XsdOptions.DESIGN_RUSSIAN_DOLL:
strategy = new RussianDollStrategy();
break;
case Inst2XsdOptions.DESIGN_SALAMI_SLICE:
strategy = new SalamiSliceStrategy();
break;
case Inst2XsdOptions.DESIGN_VENETIAN_BLIND:
strategy = new VenetianBlindStrategy();
break;
default:
throw new IllegalArgumentException("Unknown design.");
}
// processDoc the instance
strategy.processDoc(instances, options, typeSystemHolder);
if (options.isVerbose())
System.out.println("typeSystemHolder.toString(): " + typeSystemHolder);
SchemaDocument[] sDocs = typeSystemHolder.getSchemaDocuments();
return sDocs;
}