From: Pete C. <pe...@fi...> - 2003-01-09 16:40:17
|
Ernst, > The old way of constructing an XMLOutputter object: > > XMLOutputter outputter = XMLOutputter.getInstance(writer, encoding); > > The new way: > > XMLOutputter outputter = new XMLOutputter(); > outputter.init(writer, encoding); > > And when you want to use the outputter for a new Writer: > > outputter.reset(); > outputter.init(writer, encoding); > > What do you think of the new way? What, exactly, does outputter.reset() do? Will it ever be called independent of init()? If not, maybe it would be cleaner to instead do: outputter.reset(writer, encoding); You could also overload it and have outputter.reset() for cases when you don't need a different writer or encoding. I guess I'd like to see the reuse case be done with a single method call if that makes sense, just so people can't forget the reset() or the init(). I think this was a good idea though. I can envision cases when I'll need to write several XML files at once, and this way I can reuse the outputter(). (Maybe similar to a database connection or something.) Gratefully, Pete Cassetta pe...@fi... ------------------------------------------- Fingertip Software 433 Kitty Hawk Rd., Suite 216 P.O. Box 2487 Universal City, TX 78148 Orders: (800) 209-4063 -or- (210) 659-6832 Support: (210) 659-2532 Fax: (210) 659-8870 http://www.fingertipsoft.com ------------------------------------------- |