Java Mailing List Archive

http://www.ant-tasks.com/

Home » Ant Users List »

Re: writing to XML

Steve Loughran

2008-05-01

Replies:

Author LoginPost Reply
Guy Catz wrote:
> Hi.
>
> What I actually need, is to write data into a XML file, so I will be
> able to render this XML to a HTML as a report.
> The XML structure is something I know.
>
> Thanks.
>

There is an <echoxml> task that takes well formed XML and echoes it.

<echoxml file="subbuild.xml">
 <project default="foo">
  <target name="foo">
    <echo>foo</echo>
  </target>
 </project>
</echoxml>

One thing you have to watch out for here is namespace games. If you want
xml in a new namespace
-declare the namespaces inside the echoxml
-keep it all explicit
-check the output by hand to see that it looks ok

you can use <xmlvalidate> and <schemavalidate> to automate those checks


--
Steve Loughran            http://www.1060.org/blogxter/publish/5
Author: Ant in Action       http://antbook.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.