[jdom-interest] Request -- please allow all XML 1.1
conformant text in Element.se tText()
Elliotte Rusty Harold
elharo at metalab.unc.edu
Sat Mar 6 07:31:59 PST 2004
At 12:57 AM +1100 3/7/04, Chris B. wrote:
>Elliotte Rusty Harold wrote:
>
>> I have. Have you? Java assertions do not meet Meyer's design by
>>contract criteria.
>
>
>They are the closest thing we've got.
Not even close. Preconditions are implemented in Java by writing code
that checks them and throwing an exception (most often an
IllegalArgumentException though in JDOM's case often a custom
exception like IllegalNameException) if they're violated. Not as
clean as syntactic support, but it works.
>I havn't heard anybody saying they want to change the semantics of
>JDOM. They only want to force JDOM to assume that their data is
>correct without having it re-checked.
Then you haven't been paying attention. Jason suggested using
UnverifiedJDOMFactory to enable 1.1 names. That's a very clear change
in the semantics.
>Since Java doesn't have inherited preconditions, you're just going
>to have to trust that people who sub-class to not violate the public
>API. But as Bertrand Meyer would say, it's not up to you to predict
>and prevent people from extending your class.
In some situations, perhaps. But this isn't one of them. And if you
do that, then you have to document out the wazoo exactly what is
expected of subclasses. And where does Meyer say that?
--
Elliotte Rusty Harold
elharo at metalab.unc.edu
Effective XML (Addison-Wesley, 2003)
http://www.cafeconleche.org/books/effectivexml
http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA
More information about the jdom-interest
mailing list