Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Ant task and XML character data
Ant task and XML character data [message #240088] Wed, 24 January 2007 17:51 Go to next message
Eclipse UserFriend
Hi All,
How can I send XML character data (text nested between the start end end
tags) to an Ant task ?
I expected the task to handle the first nested tag as text if there is
no other method (create, add, addConfigured) to handle it.

Thx.
Re: Ant task and XML character data [message #240104 is a reply to message #240088] Thu, 25 January 2007 03:33 Go to previous messageGo to next message
Eclipse UserFriend
Laszlo Benedek wrote:
> Hi All,
> How can I send XML character data (text nested between the start end end
> tags) to an Ant task ?
> I expected the task to handle the first nested tag as text if there is
> no other method (create, add, addConfigured) to handle it.
>
> Thx.

Maybe the CDTATA tag can help you.

e.g.
<project name="squares" default="main" basedir=".">

<target name="main">

<script language="javascript"> <![CDATA[

for (i=1; i<=10; i++) {
echo = squares.createTask("echo");
echo.setMessage(i*i);
echo.perform();
}

]]> </script>

</target>

</project>

from http://ant.apache.org/manual/OptionalTasks/script.html
Re: Ant task and XML character data [message #240131 is a reply to message #240104] Thu, 25 January 2007 10:03 Go to previous message
Eclipse UserFriend
Philippe Mulet wrote:
> Laszlo Benedek wrote:
>> Hi All,
>> How can I send XML character data (text nested between the start end
>> end tags) to an Ant task ?
>> I expected the task to handle the first nested tag as text if there is
>> no other method (create, add, addConfigured) to handle it.
>>
>> Thx.
>
> Maybe the CDTATA tag can help you.
>
> e.g.
> <project name="squares" default="main" basedir=".">
>
> <target name="main">
>
> <script language="javascript"> <![CDATA[
>
> for (i=1; i<=10; i++) {
> echo = squares.createTask("echo");
> echo.setMessage(i*i);
> echo.perform();
> }
>
> ]]> </script>
>
> </target>
>
> </project>
>
> from http://ant.apache.org/manual/OptionalTasks/script.html

Philippe,
Thanks for the tip. The following works and does exactly what I need:

<target name="default">
<testTask>
<![CDATA[
<root>
<nested1>
<tag value="1">
<tag value="2">
</nested1>
<nested2>
<tag value="3">
<tag value="4">
</nested2>
</root>
]]>
</testTask>
</target>

The CDATA can be captured with addText().
Previous Topic:Help with 3.3M4 ! 'Open Type' does not show project classes
Next Topic:Remote debugging of RMI app broken in 3.3.M4 ?
Goto Forum:
  


Current Time: Mon May 12 04:51:22 EDT 2025

Powered by FUDForum. Page generated in 0.03220 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top