if (filter == null) {
builderPool = new BuilderPool(config, new BuilderFactory());
} else {
BuilderFactory builderFactory = new BuilderFactory() {
protected Builder newBuilder(XMLReader parser, boolean validate) {
StreamingTransform myTransform = new StreamingTransform() {
public Nodes transform(Element subtree) {
return XQueryUtil.xquery(subtree, filterQuery);
}
};
return new Builder(parser, validate, filter.createNodeFactory(null, myTransform));
}
};
builderPool = new BuilderPool(config, builderFactory);
}
// prepare DocumentFactory and DocumentPool
DocumentFactory docFactory = new DocumentFactory() {
public Document createDocument(InputStream input, URI baseURI)
throws ParsingException, IOException {
long start = System.currentTimeMillis();
Document doc;
if (baseURI != null && baseURI.getPath().endsWith(".bnux")) {
if (filter == null) {
doc = getBinaryXMLFactory().createDocument(input, baseURI);
} else {
StreamingTransform myTransform = new StreamingTransform() {
public Nodes transform(Element subtree) {
return XQueryUtil.xquery(subtree, filterQuery);
}
};