[jdom-interest] SaxBuilder and extra features

Jason Hunter jhunter at collab.net
Sun Aug 13 18:18:35 PDT 2000

> > That's why we keep mail archives.  :-)
> but they don't have search :P

Not a web-based search, but you can get the full text for each month and
search through there.  Works great so long as you're not on 56K.  :-)

> Specifically I need to do schema validation. This is
> possible under xerces by setting
> http://apache.org/xml/features/validation/schema
> I also need to be able to validate documents if and only if
> they have a DTD which is done via the feature.
> http://apache.org/xml/features/validation/dynamic
> Currently to enable this I have to copy-paste all code in
> SAXBuilder. SAXBuilder is not built with inheritance in mind
> and thus I can't sub-class it to get functionality. So
> rather than rewrite it all from scratch I would like to
> either allow core support for extra features or else make
> SAXBuilder sub-classable. Am I missing anything ? :P

Thanks, what do people think?

My first point of concern is that these features are Xerces-specific. 
I'd like to keep implementation details out of JDOM.  Allowing a
setFeature() method doesn't directly tie us to any particular impl, but
it does encourage users to tie themselves to one.  If people think
features like this are really needed, it might be better to have a
setSchemaValidation() method on SAXBuilder and so on.  It gets thorny
though if not all parsers support similar features or implement features
in different ways.  There are some core properties though, most of which
we don't let people set.  

My second point of concern is that there are some features (like
namespaces) that need to be set a certain way for SAXBuilder to work,
and exposing a setFeature() could easily break things.  Providing
specific setXXX() methods solves this problem.  It does bloat up
SAXBuilder's API though.  We could instead just sanity check what people
set, and throw exceptions on features we won't let be set.

Enough brainstorming, back to work...


More information about the jdom-interest mailing list