xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
- From: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
- To: dirk bergstrom <dirk AT juniper.net>
- Cc: xom-interest <xom-interest AT lists.ibiblio.org>
- Subject: Re: [XOM-interest] A small request
- Date: Tue, 6 Jan 2004 20:10:38 -0500
At 3:41 PM -0800 1/6/04, dirk bergstrom wrote:
I know that you're opposed to spurious convenience methods, but I think that
the effort required to implement the solution is sufficiently high (19
lines), that it would be worthwhile.
It's not merely the effort to implement it. It's the effort to understand it. I think the complexity of a class's API is more than linear in the number of public methods. I've seen this in JDOM where at least some versions have had lots of little, picky methods to set every possible option and combination thereof that differed from each other in very minute, not always obvious ways. (The latest version of JDOM is a little better, but not clean enough yet for my tastes.)
I also don't think your use-case is common. This is the first time I've heard of a request for it. So I'm not going to add it to the core API. There are some other options for you though:
1. You can set a maxLength and an indent and then add an xml:space="preserve" attribute to all elements where you don't want an internal break to appear. Even when indenting and wrapping the Serializer will not change the white space inside an element with xml:space="preserve" (Or if it does, that's a bug I need to fix.
2. You can write your own subclass of Serializer that provides the methods and behavior you need.
3. You can use nu.xom.samples.WrappingSerializer. This follows John Cowan's suggestion of a Serializer subclass that can be configured to pretty print without changing its infoset. That is, it only adds white space in the prolog, epilog, and inside tags. Just be warned that I make no promises about the stability of classes in the sampels package, and they have not been heavily tested like the classes in the core, so they may well have bugs.
--
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
-
[XOM-interest] A small request,
dirk bergstrom, 01/06/2004
-
Re: [XOM-interest] A small request,
Elliotte Rusty Harold, 01/06/2004
- Re: [XOM-interest] A small request, dirk bergstrom, 01/06/2004
-
Re: [XOM-interest] A small request,
Elliotte Rusty Harold, 01/06/2004
Archive powered by MHonArc 2.6.24.