[From nobody Mon Sep 20 16:26:07 2004 Return-Path: <ross.shumway@lmco.com> Received: from servlets.kattare.com (servlets.com [69.59.195.135]) by jhunter.xquery.com (8.12.8/8.12.9) with ESMTP id i8KML4R4025150 for <jhunterp@xquery.com>; Mon, 20 Sep 2004 15:21:04 -0700 Received: from mailgw2a.lmco.com (mailgw2a.lmco.com [192.91.147.7]) by servlets.kattare.com (8.12.10/8.12.11) with ESMTP id i8KMLi5N022802 for <jdom-interest@servlets.com>; Mon, 20 Sep 2004 15:21:50 -0700 Received: from emss01g01.ems.lmco.com (relay1.ems.lmco.com [129.197.181.54]) by mailgw2a.lmco.com (8.12.10/8.12.10) with ESMTP id i8KMLfKn011630 for <jdom-interest@servlets.com>; Mon, 20 Sep 2004 18:21:41 -0400 (EDT) Received: from CONVERSION-DAEMON.lmco.com by lmco.com (PMDF V6.1-1X6 #30875) id <0I4D00G01245UV@lmco.com> for jdom-interest@servlets.com; Mon, 20 Sep 2004 15:21:41 -0700 (PDT) Received: from EMSS01I00.us.lmco.com ([129.197.181.70]) by lmco.com (PMDF V6.1-1X6 #30875) with ESMTP id <0I4D00DV524439@lmco.com> for jdom-interest@servlets.com; Mon, 20 Sep 2004 15:21:40 -0700 (PDT) Received: from EMSS01M10.us.lmco.com ([129.197.181.75]) by EMSS01I00.us.lmco.com with Microsoft SMTPSVC(5.0.2195.6713); Mon, 20 Sep 2004 15:21:40 -0700 Date: Mon, 20 Sep 2004 15:21:40 -0700 From: "Shumway, Ross" <ross.shumway@lmco.com> Subject: Custom JDOM Output Nightmare To: jdom-interest@servlets.com Message-id: <573562C6FDA9564A8EEE66D899BC190B09FB18F6@emss01m10.us.lmco.com> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft Exchange V6.0.6556.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Thread-Topic: Custom JDOM Output Nightmare Thread-Index: AcSV18jYKWToJYq1QX6vaAsV4YpTJwJhBX0g content-class: urn:content-classes:message X-MS-Has-Attach: X-MS-TNEF-Correlator: X-OriginalArrivalTime: 20 Sep 2004 22:21:40.0273 (UTC) FILETIME=[337D1A10:01C49F60] X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on xquery.xquery.com X-Spam-Status: No, hits=-4.9 required=5.0 tests=BAYES_00 autolearn=ham version=2.63 X-Spam-Level: I am processing XHTML and I need to be able to control what empty tags expand and which don't on a tag name basis. No problem I figure, I'll just subclass XMLOutputter add my new bit of functionality and away I go. Hmmm, well I really ought to add the formatting info to the Format class. OK I'll just subclass that too. Ooops, Format has only a private constructor...no subclassing. Why wouldn't you allow someone to extent Format? It seems like a natural thing to want to do. Well OK, I'll just add the info to XMLOutputter. It's not as well encapsulated, but what the hey. Ooops, XMLOutputter.printElement() depends on a bunch of private methods. That certainly makes subclassing a pain! Darn. OK, well I guess I will just copy and repackage XMLOutputter and then patch the copy. Darn, XMLOutputter directly accesses Format members, (bad form), which have package level access. Shoot! OK, I guess I will copy and repackage Format as well. Oh, and just for good measure, XMLOutputter also uses NamespaceStack, which of course, is a package access class. Copy and repackage as well. By the time I had figured all the above out, my 5 minute patch had turned into a 2 hour stressful headache. I just couldn't believe that JDOM, which claims to be making my life easier would really make it this hard to create slightly customized output. Please tell me that I am all screwed up and that there really is a much easier way. I know I could have just hacked the JDOM source directly, but I just couldn't bring myself to do something that evil and it would surely have bit me the next time I went to update my version of JDOM. ]