> While SAX is fast, I've found callback interfaces > more difficult to > deal with while generating nested object graphs... > it normally > requires one to maintain state in stack(s).
I've gone to some trouble to avoid the effects of this on the programming model. Stack management is handled by the parser and the builder at each level in the stack can delegate control and consume output of delegate builders without maintaining complex state. For example, the builder for FilteredQuerys has to handle this: <FilteredQuery> <Filter> <RangeFilter fieldName="price" lowerTerm="10" pperTerm="20"/> </Filter> <Query><TermQuery field="contents" value="car"/></Query> </FilteredQuery> To delegate control to any choice of filter or query parser builder and consume its output it simply does this: if (localName.equals("Filter")) { parser.delegateChildElements(new ObjectBuilderFinder(), new ObjectConsumer() { public void setObject(Object objectValue) { filter = (Filter) objectValue; } }); It looks like procedural code calling, then setting instance data ("filter") but is actually still all event based SAX under the covers. Cheers Mark ___________________________________________________________ To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]