Why wouldn't simply using DOM be sufficient? Is it envisioned that
a query XML would be large enough to prohibit RAM DOM loading of the
entire document?
Erik
On Dec 16, 2005, at 2:51 AM, mark harwood wrote:
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]