ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <>
Subject Re: Project.toXML() ?
Date Sun, 13 Oct 2002 22:52:51 GMT
On 2002.10.13 18:26:12 -0400 Costin Manolache wrote:
> Matt Bishop wrote:
> > Is there any code available to dump a Project object out to XML?  I am
> not
> > concerned with preserving comments, whitespace, etc. from the load,
> just
> > want to emit the Project tree.
> Not yet - AFAIK. 
> In general, it is not possible using the current model - the document is 
> read using SAX and most tasks are created on the fly. In order to 
> get the XML you would need how to reconstruct the xml from beans. That
> requires getters on all beans and knowledge on what is 'real' data
> and what is just runtime getter.
> One thing that seems possible is to use
> UnknownElement/RuntimeConfigurable
> on all tasks ( right now they are used only in special cases, when the
> type is not known at parsing time ). I have the code working fine 
> ( i.e. most projects I work on and gump seem fine ). Using this it would
> be possible to reconstruct the xml form.
> Another aproach that would also preserve the comments is to use a 
> ProjectHelper that is based on DOM.
> I'm not sure why would you want that - since you could just read
> the original document. It is only interesting when you create the
> Project at runtime, using API calls, or when you use some tool to
> dynamically change the project ( edit properties, etc ). 
> ( I'm very interested in those use-cases, not only in ant but also
> on tomcat - where the server.xml must be saved to reflect changes
> made via JMX )

Saving changes in your mbeans is IMO best handled by using a jmx and
modelmbean implementation that implements persistence.  Writing out
something like the original xml config file is more or less disasterous:
after trying it in jboss 2.2 we will never go back.

Perhaps studying these related problems will lead an ant developer to
consider my proposal that much of the infrastructure and many of the
infrastructure problems of ant could be eliminated by making ant into a
bunch of mbeans running in an mbean server.

david jencks
> -- 
> Costin
> --
> To unsubscribe, e-mail:   <>
> For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message