ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Costin Manolache <>
Subject Re: Project.toXML() ?
Date Sun, 13 Oct 2002 22:26:12 GMT
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 )


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

View raw message