[jdom-interest] Legal values of line separator

Elliotte Rusty Harold elharo at metalab.unc.edu
Sat Jul 8 15:49:21 PDT 2000


What should we limit the legal values of the line separator to, if
anything?

* \r, \n, and \r\n?

* Any combination of XML allowed white space?

* Anything that might be legal XML text?

We should probably throw an IllegalArgumentException if a bad value is
passed in.

If we do limit users to the three common cases of \r, \n, and \r\n, plus
possibly the empty string, then maybe these should be available as named
constants somewhere, probably using the typesafe enum pattern. Thoughts?

-- 
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+ 
|               Java I/O (O'Reilly & Associates, 1999)               |
|            http://metalab.unc.edu/javafaq/books/javaio/            |
|   http://www.amazon.com/exec/obidos/ISBN=1565924851/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/     |
+----------------------------------+---------------------------------+

Received: from gvmail01.epo.org ([145.64.128.100])
	by dorothy.denveronline.net (8.9.3/8.9.3) with ESMTP id HAA17386
	for <jdom-interest at jdom.org>; Fri, 7 Jul 2000 07:13:15 -0600 (MDT)
Received: from gvmail02.th.epo.nl (unverified) by gvmail01.epo.org
 (Content Technologies SMTPRS 4.1.5) with ESMTP id <Tc0a83264824d428ddb12 at gvmail01.epo.org> for <jdom-interest at jdom.org>;
 Fri, 7 Jul 2000 14:44:34 +0200
Received: from epo.org ([172.16.33.217]) by gvmail02.th.epo.nl
          (Netscape Messaging Server 3.62)  with ESMTP id 379
          for <jdom-interest at jdom.org>; Fri, 7 Jul 2000 14:47:47 +0200
Message-ID: <3965D1B2.65D6A6A7 at epo.org>
Date: Fri, 07 Jul 2000 14:48:50 +0200
From: Andre Van Delft <avandelft at epo.org>
Organization: European Patent Office
X-Mailer: Mozilla 4.7 [en-gb] (WinNT; I)
X-Accept-Language: en
MIME-Version: 1.0
To: jdom-interest at jdom.org
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [jdom-interest] NoSuch*Exceptions in JDOM
Sender: jdom-interest-admin at jdom.org
Errors-To: jdom-interest-admin at jdom.org
X-BeenThere: jdom-interest at jdom.org
X-Mailman-Version: 2.0beta2
Precedence: bulk
List-Id: JDOM Mailing List for General Issues and Updates <jdom-interest.jdom.org>

In some cases I want a NoSuch*Exception, when a child or attribute must
be present.
In some cases the child or attribute is optional; then I want null
returned since there is no exceptional situation, and my code should be
simple.

We can have it both ways.
I use a util function getChild that returns a null if the child is
absent.
I prefer the Element.getChild function to behave like this.
The old Element.getChild functions throwing the exceptions may well be
renamed into mustGetChild.
That would do, IMHO.





More information about the jdom-interest mailing list