[jdom-interest] Opening SAXBuilder interface

Laurent Bihanic laurent.bihanic at atosorigin.com
Thu May 17 12:10:43 PDT 2001


Hi,

Another request for some API changes !

Context: Using JDOM on a project that has a strong SAX legacy ;-)

Request #1: Make build(InputSource) public
Use cases:
  1. Introducing JDOM in an environment where programmers use InputSources a 
lot without having to code and maintain the tests to decide whether calling 
build(InputStream), build(Reader) or build(URL)
  2. Using JAXP Source objects that are easily converted into SAXSource that 
offers a getInputSource (back to use case #1)

Request #2: Add a public method build(InputSource, XMLReader).
Use case: Allow reuse of weird XMLReaders, e.g. a "XMLReader" that takes a 
fixed-width COBOL file and present a XML view of it. No, I can't use "new 
SAXBuilder(className)" because the reader need extra configuration prior being 
usable for parsing. Of course, the reader shall accept all the setProperty, 
setFeature and setXxxHandler JDOM requires to configure the parser.

These changes only require:
  - changing build(InputSource) into build(InputSource,XMLReader) (public)
  - create a new public method build(InputSource) to call build(InputSource,null)
  - testing whether a XMLReader is provided before allocating one

So it's mainly a pure API design issue.

Opinions ?

Laurent




More information about the jdom-interest mailing list