BinaryValue exiBinary = ((BinaryValue)args[0].itemAt(0));
MemTreeBuilder builder = context.getDocumentBuilder();
// create default factory and EXI grammar for schema
EXIFactory exiFactory = DefaultEXIFactory.newInstance();
if(args.length > 1) {
if(!args[1].isEmpty()) {
Item xsdItem = args[1].itemAt(0);
InputStream xsdInputStream = EXIUtils.getInputStream(xsdItem, context);
GrammarFactory grammarFactory = GrammarFactory.newInstance();
Grammar grammar = grammarFactory.createGrammar(xsdInputStream);
exiFactory.setGrammar(grammar);
}
}
SAXDecoder decoder = new SAXDecoder(exiFactory);
SAXAdapter adapter = new AppendingSAXAdapter(builder);
decoder.setContentHandler(adapter);