Delegating SAX Parser Handler. At work I'm working on refactoring / redesigning something that started as a cool idea. Basically, you register sub handlers to a root handler with the path you're interested in getting messages for (like "/document/header/title" would get you the events for the document title). Would anyone be interested in us releasing this as opensource? It's really kind of neat, if you need that kind of thing. It's especially useful for cutting up big XML documents into small pieces... [Jason Carreira]
It does sound quite similar to digester which allows you to register interest in SAX events using abolute paths, relative paths, wildcards and so forth and apply Rules when the SAX events fire. Plus there's default rules for all kinds of things like creating beans, setting bean properties, invoking methods. There's a default object stack so its very handy for parsing XML config files and turning them into your domain objects.
Incidentally the betwixt component reuses the digester and auto-defaults rules to parse XML into beans and also turns beans back into XML again, using default introspection rules.
Competition in open source can be healthy, though I do prefer reuse when it makes sense since it promotes a bigger user community which often results in better tested and better documented software. So I'd recommend evaluating digester first to see if the effort of starting your own project and supporting it is worth the effort.
7:10:31 AM
|