[jdom-interest] standalone revisited
erik_eide at yahoo.com
Thu Apr 4 05:22:00 PST 2002
I'd like to bring up the issue of the standalone tag
in the XML declaration, once again (sorry).
Sifting through the posts in the JDOM archive, there
seems to have been discussion regarding where it
belongs - the two candidates that caught my eye being
the Document and XMLOutputter objects.
Having previously hacked the XMLOutputter to include a
setStandalone(String standalone), and
setOmitStandalone(boolean standalone) method - I
started wondering if this was ledgit with the XML
The spec seems to indicate that the standalone tag (if
present) should only have the value yes if a number of
conditions within the document hold true, such as the
absence of external references, etc etc.
So, following a some kind of OO design rule where an
object is responsible for its state, my feeling is
that this responsibility lies in the Document object -
as the state of the standalone tag is dependent on the
state of other "attributes" within the Document
I wonder though, if perhaps a cleaner approach is to
simply extract the entire XML declaration into its own
object - and associate it with the Document object,
given that two of the fields in it, version and
standalone, probably have more meaning to the Document
object than the XMLOutputter.
I can imagine, that in the future versions of XML -
one might also like to compare the version of XML a
document represents, or to even to change it without
having to output it.
I'd agree that encoding probably has more meaning to
the XMLOutputter than anything else, but fetching this
from the Document object when calling output(Document)
seems pretty trivial.
Anyway, I seem to have drifted off the topic here.
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
More information about the jdom-interest