Search in sources :

Example 1 with FidelityOptions

use of com.siemens.ct.exi.FidelityOptions in project arctic-sea by 52North.

the class EXIUtils method newEXIFactory.

/**
 * @return An {@link EXIFactory} instance configured according the service
 *         configuration.
 *
 * @throws UnsupportedOption
 *             if one of the fidelity options is not supported.
 */
public EXIFactory newEXIFactory() throws UnsupportedOption {
    EXIFactory factory = DefaultEXIFactory.newInstance();
    factory.setGrammars(getGrammars());
    // something else?
    if (this.isStrict) {
        factory.setFidelityOptions(FidelityOptions.createStrict());
    } else if (this.isDefault) {
        factory.setFidelityOptions(FidelityOptions.createDefault());
    } else {
        FidelityOptions options = factory.getFidelityOptions();
        options.setFidelity(FidelityOptions.FEATURE_COMMENT, this.preserveComments);
        options.setFidelity(FidelityOptions.FEATURE_PI, this.preserveProcessingInstructions);
        options.setFidelity(FidelityOptions.FEATURE_DTD, this.preserveDTD);
        options.setFidelity(FidelityOptions.FEATURE_PREFIX, this.preservePrefixes);
        options.setFidelity(FidelityOptions.FEATURE_LEXICAL_VALUE, this.preserveLexicalValue);
    }
    factory.setCodingMode(alignment);
    // }
    return factory;
}
Also used : FidelityOptions(com.siemens.ct.exi.FidelityOptions) EXIFactory(com.siemens.ct.exi.EXIFactory) DefaultEXIFactory(com.siemens.ct.exi.helpers.DefaultEXIFactory)

Aggregations

EXIFactory (com.siemens.ct.exi.EXIFactory)1 FidelityOptions (com.siemens.ct.exi.FidelityOptions)1 DefaultEXIFactory (com.siemens.ct.exi.helpers.DefaultEXIFactory)1