ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ant-u...@ml.icemark.net
Subject arbitrary XML in custom ant tasks?
Date Wed, 21 Jan 2004 10:06:36 GMT

I've recently started to try and generate custom ant tasks to
handle some software testing issues for a framework we develop (at
the company I'm working for that is).

I have been able to generate some custom tasks with parameters and
nested elements below. But - one I am missing one thing - is it
possible to also embed arbitrary XML inside a build task and access
it as a DOM tree?   I would need to build an XML tree that has a
part XML data in it that needs to be passed to one of the tests -
but since these tests are somewhat common and the XML pieces are
rather short, I'd like to embed them into the build file directly
instead of having dozens of separate files for them. With the
current way of handling nested elements I would have to write a LOT
of code to make that possible...

What I would be looking for would be something along the line of
having a build file as follows:

	<target name="test1">
	  <senddata dest="mydest1" opts="myopts1">
	    <dataset>
	      <abc><bcd><gg type="foo" /></bcd><ggg type="bar"/></abc>
	    </dataset>
	    <dataset>
	      <gugus/>
	    </dataset>
	  </senddata>
	</target>

And in terms of the custom task, I'm looking for a method - say
"xmlAddDataset(Element data)" which would pass the
<abc>[somedata]</abc> into the function as a DOM element for the
custom tag to handle directly.

Is something like that possible right now? Or would I need to put
the XML snippet into the build file with all < and > replaced by
&lt; and &gt; and then parse it manually (which, of course, would
be a possibility - but it doesn't strike me as all that elegant, as
direct embedding of the XML would allow for an XML editor to at
least check that the file is well-formed while I am creating the file)?



Benedikt

  ALLIANCE, n.  In international politics, the union of two thieves who
    have their hands so deeply inserted in each other's pockets that
    they cannot separately plunder a third.
			(Ambrose Bierce, The Devil's Dictionary)

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


Mime
View raw message