[jdom-interest] Legal values of line separator

Jason Hunter jhunter at acm.org
Sat Jul 8 18:12:27 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?

One possibility is to just let them set a boolean flag that says they
want to use the platform-specific line ending for their platform.  That
makes the call a lot clearer than

What you lose is the ability on a Mac to write \n line endings, and any
other mix and match.  But we also lose the concern that someone will go
crazy and set the separator to "<br>".  :-)  

Do people see use cases where you really want to set a separator other
than what's on your platform?  If so, we could use constants of MAC,
WINDOWS, or UNIX but keep away from letting someone specify a string
themselves.  That would cover all reasonable use cases I'd think.


More information about the jdom-interest mailing list