
com.siemens.ct.exi.main.api.sax.SAXFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of exificient Show documentation
Show all versions of exificient Show documentation
EXIficient is an open source implementation of the W3C Efficient XML Interchange
(EXI) format specification written in the Java programming language. The EXI format is a very
compact representation for the Extensible Markup Language (XML) Information Set that is intended
to simultaneously optimize performance and the utilization of computational resources.
package com.siemens.ct.exi.main.api.sax;
import org.xml.sax.XMLReader;
import com.siemens.ct.exi.core.EXIFactory;
import com.siemens.ct.exi.core.FidelityOptions;
import com.siemens.ct.exi.core.exceptions.EXIException;
public class SAXFactory {
protected final EXIFactory exiFactory;
public SAXFactory(EXIFactory exiFactory) {
this.exiFactory = exiFactory;
}
/**
* Returns an EXIReader
*
* @return reader using the previously set coding options.
* @throws EXIException
* EXI exception
*
*/
public XMLReader createEXIReader() throws EXIException {
return new SAXDecoder(exiFactory);
}
/**
* Returns a SAXEncoder
that implements
* DefaultHandler2
*
*
* Note that the output stream MUST be set.
*
*
* @return writer using the previously set coding options.
* @throws EXIException
* EXI exception
*
*/
public SAXEncoder createEXIWriter() throws EXIException {
final FidelityOptions fidelityOptions = exiFactory.getFidelityOptions();
if (fidelityOptions.isFidelityEnabled(FidelityOptions.FEATURE_PREFIX)
|| fidelityOptions
.isFidelityEnabled(FidelityOptions.FEATURE_COMMENT)
|| fidelityOptions
.isFidelityEnabled(FidelityOptions.FEATURE_PI)
|| fidelityOptions
.isFidelityEnabled(FidelityOptions.FEATURE_DTD)) {
return new SAXEncoderExtendedHandler(exiFactory);
} else {
return new SAXEncoder(exiFactory);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy