Lists Home |
Date Index |
Jeff Rafter wrote:
> Karl Waclawek has done some work in this area in both Delphi and C# in
> his toolkit XPEA. But I am sure he will take some ideas from this thread
> as well... it is all very interesting.
Well, XPEA really is a very low level way of building
some pattern matching on top of SAX (or other push APIs).
Predicate processing as well as attribute matching is done
through call-backs. I am not a big believer in inventing
new languages - my ambitions are a lot more modest.
Example (C# 2.0 syntax):
SaxPathDispatcher<EventStatus> disp = new SaxPathDispatcher<EventStatus>();
/* Path related set-up */
Div1Handler div1 = new Div1Handler(...);
Div2Handler div2 = new Div2Handler(...);
BasicPathFactory pathFactory = new BasicPathFactory(...);
// Add path with call-back arguments: "/spec/*//div1[div1]/div2[div2]"
BasicPath path = pathFactory.Create("/spec/*//div1/div2", div1, div2);
Div1Handler and Div2Handler are implementations of the IElementHandler
interface and their events are called when they match the path above.
Really just one step more than SAX. I use it for writing SAX-based