[jdom-interest] Re: First impressions and some suggestions
Elliotte Rusty Harold
elharo at metalab.unc.edu
Fri Jun 9 06:43:46 PDT 2000
At 4:10 AM -0700 6/8/00, Alex Chaffee wrote:
>
>As I understand it, Elliotte, people will want to use JDOM because it
>*doesn't* act like a (typical) XML parser.
Not at all. People will want to use JDOM because it is a better
parser API, not because it's a non-standard parser. They expect it to
fully and correctly implement XML 1.0.
>Meaning that the DWIM
>button ("Do What I Mean") should, by default, be switched on. Since,
>as Jason pointed out, most programmers feel that
>
> <name>
> Alex
> </name>
>
How do you know what I mean? In many cases I expect white space to be
preserved. Better yet, here's an example I just thought of. Consider
this common construct:
<name>
<first>Alex</first>
<last>Chaffee</last>
</name>
Now ask for the contents of the name element, or of the first and
last elements one after the other. Do you expect "Alex Chaffee" or
"AlexChaffee"? Which is JDOM providing? Which does the XML spec
require?
Or how about this case:
<name><first>Alex</first><last>Chaffee</last></name>
Should JDOM insert extra white space between "Alex" and "Chaffee"
because that's what most people would initially expect? What seems
obvious depends on which cases you look at. It's better just to stick
with the spec. That way, at least if the behavior seems inobvious
(and it will always seem inobvious to someone) they can understand it
based on the spec. Otherwise, the nonconformant cases will appear
weird for no reason at all.
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| The XML Bible (IDG Books, 1999) |
| http://metalab.unc.edu/xml/books/bible/ |
| http://www.amazon.com/exec/obidos/ISBN=0764532367/cafeaulaitA/ |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://metalab.unc.edu/javafaq/ |
| Read Cafe con Leche for XML News: http://metalab.unc.edu/xml/ |
+----------------------------------+---------------------------------+
More information about the jdom-interest
mailing list