public static void execute(final XMLConsumer consumer,
ObjectModel objectModel,
ExecutionContext executionContext, MacroContext macroContext, NamespacesTable namespaces,
Event startEvent, Event endEvent) throws SAXException {
Event ev = startEvent;
LocatorFacade loc = new LocatorFacade(ev.getLocation());
consumer.setDocumentLocator(loc);
while (ev != endEvent) {
loc.setDocumentLocator(ev.getLocation());
// ContentHandler methods
if (ev instanceof StartElement) {
StartElement startElement = (StartElement) ev;
Define def = (Define) executionContext
.getDefinitions().get(startElement.getQname());
if (def == null) {
ev = ev.execute(consumer, objectModel,
executionContext, macroContext, namespaces, startEvent, endEvent);
continue;
}
Call call = new Call( def, startElement );
ev = call.execute(consumer, objectModel,
executionContext, macroContext, namespaces, startEvent, endEvent);
} else
ev = ev.execute(consumer, objectModel, executionContext,
macroContext, namespaces, startEvent, endEvent);
}
}