[jdom-interest] making XMLOutputter DTD-aware
paul at activemath.org
Tue Jul 26 08:05:40 PDT 2005
I gave some cycles into making XMLOutputter DTD-aware.
The reason for doing so is that we write XML-files with a dtd-reference
with a large set of hidden information encoded in the DTD such as
namespace for almost all elements. Most of these are attribute default
Only using such an outputter I can claim that our authors' files are
not changed too dramatically. Otherwise, each line is made twice as big
and completely unreadable.
Clearly using a finer-grained parsing (that would report wether an
attribute is present or only "implied") would bring it all... but such
fine-grained lexical analysis isn't available as far as I know.
So I just adapted XMLOutputter to prevent the output of attributes of
namespaces if equivalent to the DTD-specified values... seems to be
I'd love providing this to the project. It is relying on Mark Wutka's
DTD parser, now with an Apache-style-license, which is the only usable
DTD-parser I found.
Where could I drop such a submission ?
Also I would have wished to subclass XMLOutputter but this turned out
to be impossible... there are too many private methods that needed to
be either re-used or overridden... not sure if that's solvable.
Currently, I just added "setDtd" and modified XMLOuputter's methods
More information about the jdom-interest