ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: build.xml snippet used from code
Date Wed, 13 Aug 2003 21:08:12 GMT
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 [mailto:gudnabrsam@yahoo.com]
> 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 similar
> functionality from the context of a Java class.
> 
> Thanks,
> Matt

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message