[jdom-interest] Question about "standalone" tag... [eg]

Joseph Bowbeer jozart at csi.com
Sat Apr 7 15:47:13 PDT 2001


PS - Concerning where the standalone attribute belongs, I don't have a
strong opinion either way.  I think it boils down to whether standalone is
conceptually a property of the document, or merely something included in the
textual representation for the benefit of the parser.

However, even if standalone is moved into the document, I think the
outputter should provide an option for controlling whether or not to add the
standalone setting (whatever it may be) to the xml declaration.


----- Original Message -----
From: "Joseph Bowbeer" <jozart at csi.com>
To: <jdom-interest at jdom.org>
Sent: Friday, April 06, 2001 12:38 PM
Subject: Question about "standalone" tag... [eg]


jh writes:

> At the moment I'm thinking of putting both [encoding & standalone]
> in Document to better match Infoset.

Background: The standalone attribute is an optimization hint for the parser
(right?), indicating that the document doesn't depend on declarations in
external entities, and if there is no external DTD, then standalone is
assumed to be "yes".

I'd expected that the standalone attribute of the xml declaration would be a
property of the outputter, but I hadn't thought about it too much.

Even if a standalone property is added to the document, I think the
outputter should be allowed to override.  Otherwise, a client may not be
able to output a document created by someone else without first modifying
the document (eg, without first clearing the standalone property).


----- original message -----
From: Jason Hunter jhunter at collab.net
Date: Fri, 06 Apr 2001 10:18:04 -0700

Jason Hunter wrote:
>
> You'll see in the TODO.txt file an entry to figure out the best way to
> support this.  It seems straightforward to have a doc.setStandalone()
> and doc.getStandalone() pair of methods that the XMLOutputter can use on
> output.  Anyone have another idea, like maybe to try to be smarter about
> it, performing some checking that what they set to be standalone truly
> is standalone?
>
> One problem here is that SAX doesn't tell us the standalone flag value,
> so round tripping won't be 100%.
>
> -jh-

More thoughts on this issue:

For the encoding we've explicitly left that out of the Document and put
it as a flag to the XMLOutputter.  Maybe standalone should be handled
similarly?  Or maybe encoding and standalone should be aspects of the
Document.  I'm curious to hear arguments either way.  At the moment I'm
thinking of putting both in Document to better match Infoset.

-jh-





More information about the jdom-interest mailing list