Hi Guys,
Between holidays and trying to get as much done as possible before our
(5th) baby comes (due in 4 1/2 weeks), I've let my XML enc/Writer
correspondence slip. Sorry about that.
I just read everything you two have posted, and I'm quite impressed with
what you're up to Henri. My XML writing needs are still quite basic, so
I don't have the same motivation as you to get all those new features
going. But they will be of great help for many potential users. I'll
have to grab the code and get a closer look at it.
> Working now. I suspect it has issues, but I think I've tweaked and
> murdered Pete's code enough that it seems to work on basic tests.
Once things stabilize, I should probably revisit pretty printing. In
order to reduce object creation and keep the code simple, you may recall
I didn't handle XHTML-style documents nicely (where many nodes contain
both text and elements). This should probably be rectified, and doing so
may require adding some options to the constructor and/or via a method
like setPrettyPrintOptions().
> Writer sw = new StringWriter();
> XmlWriter xw = new XmlEncXmlWriter(sw);
> xw = new FormattingXmlWriter(xw).setDateFormat(
> new java.text.SimpleDateFormat("yyyy-MM-dd")).
> setNumberFormat(new java.text.DecimalFormat("#"));
> xw = new EmptyElementXmlWriter(xw).
> setEmptyMode(EmptyElementXmlWriter.NULL_EMPTY_MODE);
> xw = new PrettyPrinterXmlWriter(xw);
A bit messy/complex, but that's the price you pay for flexibility I guess.
> [I've made all setXxx methods return their object. Probably breaks the
> Bean-ness, but I'm treating this as a play with the method-chaining
> viewpoint]
>
> or they could do:
>
> XmlWriter xw = XmlIO.prettyPrinter(
> XmlIO.emptyElement( XmlIO.NULL_EMPTY_MODE,
> XmlIO.formatted( "yyyy-MM-dd", "#",
> XmlIO.xmlenc( new StringWriter() )
> )
> )
> );
Well, I for one applaud this breach of the bean rules. This makes the
code much more readable.
Keep up the great work. I'll try to keep in closer touch.
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
-------------------------------------------
|