[jdom-commits] CVS update: jdom/src/java/org/jdom/input
jhunter at cvs.jdom.org
jhunter at cvs.jdom.org
Thu Jun 21 10:06:36 PDT 2001
Date: Thursday June 21, 2001 @ 18:06
Author: jhunter
Update of /home/cvspublic/jdom/src/java/org/jdom/input
In directory www.nmemonix.com:/tmp/cvs-serv12576
Modified Files:
SAXBuilder.java
Log Message:
This is a refactoring of SAXBuilder to make it simpler to extend.
The patch was submitted by Alex Rosen with some suggestions coming from
Laurent Bihanic. From Alex's mail:
Attached is the updated SAXBuilder (both the full file, and the diff).
I tried a few tests and it seemed to work fine. Changes are:
- The parser is created in a separate createParser() method, and
configured in a separate configureParser() method.
- The content handler is created in a separate createContentHandler()
method, and configured in a separate configureContentHandler() method.
- Split out internalSetFeature(), so that error messages are better. We
no longer tell you that we can't turn on validation, when it's actually
namespaces that's the problem.
- If anything in the build process throws a JDOMException, we no longer
wrap it in another JDOMException in build(). We just rethrow it as-is.
- Did a small amount of rearranging and commenting, which I think makes
things a little clearer, but feel free to take it or leave it.
(Note that this is a slightly different set of changes than the one I
sent you a few weeks ago.)
Open issues:
- Didn't know what exceptions the protected methods should throw. I
made them throw Exception, since who knows what a subclass will want
to do, and we were already correctly handling Exception if it was thrown.
- Protected members - since "factory" is a private member variable, I
had to have SAXBuilder pass it in to createContentHandler(). Thus the
default implementation of createContentHandler() looks a little weird -
"factory" is passed in, even though it's accessible as a member varialbe.
But that's necessary in order for subclasses to work right. This would
be fixed if it were protected, or if there were a getFactory() method.
Alex
---
BTW, I changed "factory" to be protected so createContentHandler() doesn't
require receiving the factory anymore.
-jh-
===================================================================
File: no file SAXBuilder.java Status: Needs Checkout
Working revision: 1.53 Thu Jun 21 17:06:36 2001
Repository revision: 1.53 /home/cvspublic/jdom/src/java/org/jdom/input/SAXBuilder.java,v
Existing Tags:
start (revision: 1.1.1.1)
jdom (branch: 1.1.1)
More information about the jdom-commits
mailing list