ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Hardy <>
Subject Re: build.xml snippet used from code
Date Thu, 14 Aug 2003 11:31:45 GMT
You might get somewhere with JAXB, if you have objects and properties 
that you want to turn into java objects to manipulate at run-time.

JAXB has 2 phases - the first phase requires you to run a generator to 
create the corresponding java classes from you xml schema.

the 2nd phase is where you can create objects from those classes by 
reading in xml - marshalling and unmarshalling.

Is that where you are aiming at?


On 08/13/2003 11:18 PM Matt Benson wrote:
> Well, that gives me an answer... "no."  More
> importantly your attitude validates my desire for such
> a thing, and for that I thank you indeed.
> Meanwhile, as predicted, I have gone ahead and
> produced the alternative code for what I was trying to
> do.  Maybe this is a feature for Ant 2, or some
> third-party generated task framework designed for
> extension.
> Thanks,
> Matt
> --- Dominique Devienne <> wrote:
>>I'm not sure I understand fully what you want to do,
>>but I'd guess you'd
>>like to convert an XML snippet to Java objects,
>>similarly to how the XML
>>entity include mechanism works?
>>A true XML entity doesn't have a root element at
>>all, so it's not a valid
>>XML document, and thus cannot be read as an XML
>>document. You can create a
>>dummy in-memory XML text document that references
>>that entity and load it,
>>but that becomes tedious.
>>Now, if you have a root element, or do the hack
>>above, you still need to
>>convert the SAX events or DOM tree into something
>>usable from Java, usually
>>your Java objects, or Ant's objects. And that's here
>>that Ant is failing us,
>>because if doesn't expose it's internal engine to
>>convert XML to Java
>>instances. Often I've whished for this, being able
>>to tell Ant, "there,
>>here's an object instance, and here an XML file or
>>stream! Parse the XML
>>using the usual Ant introspection rule for that
>>instance, and populate that
>>instance". You could use Commons-Digester to do
>>that, but it would be much
>>simpler and convenient to have Ant do it within Ant.
>>You could also do like <XmlProperty>, and interpret
>>the SAX events yourself,
>>but again I find this cumbersome at best.
>>Does that help? --DD
>>>-----Original Message-----
>>>From: Matt Benson []
>>>Sent: Wednesday, August 13, 2003 1:58 PM
>>>To: Ant Users List
>>>Subject: RE: build.xml snippet used from code
>>>I have used entity includes and that serves its
>>>purpose.  However, my question was how to get
>>>functionality from the context of a Java class.
> ---------------------------------------------------------------------
>>To unsubscribe, e-mail:
>>For additional commands, e-mail:
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

ant 1.6alpha + java 1.4.2 on Linux 2.4.20 RH9

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

View raw message