Return-Path: Delivered-To: apmail-jakarta-ant-dev-archive@apache.org Received: (qmail 4869 invoked from network); 18 Nov 2002 13:29:25 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 18 Nov 2002 13:29:25 -0000 Received: (qmail 8603 invoked by uid 97); 18 Nov 2002 13:30:21 -0000 Delivered-To: qmlist-jakarta-archive-ant-dev@jakarta.apache.org Received: (qmail 8566 invoked by uid 97); 18 Nov 2002 13:30:20 -0000 Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 8554 invoked by uid 98); 18 Nov 2002 13:30:20 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Message-ID: <36E996B162DAD111B6AF0000F879AD1A76C022@nts_par1.paranor.ch> From: "Wannheden, Knut" To: 'Ant Developers List' Subject: RE: Project.toXML() ? Date: Mon, 18 Nov 2002 12:43:16 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2448.0) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C28EF7.B2C7FD74" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N ------_=_NextPart_001_01C28EF7.B2C7FD74 Content-Type: text/plain; charset="iso-8859-1" Yzz, From: Yyy Xxx [mailto:gjfdh@yahoo.com] > Costin Manolache wrote: > > > Dominique Devienne wrote: > > >> I'm amazed how a DOM-based ProjectHelper always gets dismissed > >> when it's clearly the ideal solution to provide serialization back > >> to XML from the original XML (among other things): > > >Ant1.5 supports pluggable ProjectHelpers, and nothing stops you from > >creating a DOM-based one. > > > Are there any articles, tutorials or examples on writing custom > ProjectHelpers? I've looked through the code and, with all due > respect, the ProjectHelpers look like an afterthought hack. > No, I don't think there are any other documents than the code (the two classes you've looked at). You can always search the archives and you could also look at the SAX2 based ProjectHelper in the embed proposal (browse the Ant CVS). I have created a ProjectHelper aswell, but it only subclasses the default ProjectHelperImpl and overrides parse(Project, Object) where it essentially creates the buildfile from a template before calling super.parse(Project, Object). > I'd like to read build.xml from an InputStream (originating > in a JAR). > Ant seems to be very file based wrt configuring projects. Static > methods of the ProjectHelper takes an explicit File object and have a > comment about custom ProjectHelperImpls needing to propogate this for > backwards compatability. I don't understand this comment in the > context of custom helpers. > I have asked the same question a couple of times before (take a look at http://marc.theaimsgroup.com/?l=ant-dev&m=102798448309944&w=2 and http://marc.theaimsgroup.com/?l=ant-dev&m=102278277712744&w=2). And, indeed, it seems like at least some committers feel like the File parameter should be replaced with an Object parameter, but it still needs to be changed. I suggest you open a feature request if it's really important to you. > The interface which customer helpers should implement is not > clear cut. > Both ProjectHelper and ProjectHelperImpl contain static methods and > ProjectHelperImpl extends ProjectHelper (instead of implementing it). > ProjectHelperImpl seems to do double-duty as a file reader and an XML > SAX handler. It's not clear how to redirect the input source in a > custom helper subclass while reusing the parsing capability of > ProjectHelperImpl. > Yes, I think that's somewhat dubious, too. What I did was to subclass the ProjectHelperImpl. But that might not work in your case... You could always open a feature request and propose a implementation with clearer separation of concerns. ;-) Cheers, -- knut ------_=_NextPart_001_01C28EF7.B2C7FD74--