Nested form of XML in ANT build.xml

I am a newbie to both ANT and XML. The XML syntax seems really confusing. The following three structures of "echo" are correct in my ANT.

  <echo message="Hello "/>
  <echo message="Hello "></echo>
  <echo> Hello </echo>

but when I use "fileset",

<fileset dir="." includes = "**/*.java" id="myid" />
<fileset dir="." includes = "**/*.java" id="myid2" ></fileset>

are still correct, but

  <fileset> dir="." includes = "**/*.java" id="myid2" </fileset>

are considered wrong by ANT:

The <fileset> type doesn't support nested text data ("dir="." ...="myid2"").

Is there some general rule to distinguish the syntax difference between the headings such as "fileset" and "echo", I mean, how can "echo" permits nested text data but "fileset" does not? Thanks.


Authors of echo task developed it in such a dual-use way. It can operate with "message" attribute or with child text. But other tasks (fileset is actually a type) do not support such features. Just read official documentation to know all use-cases.

Need Your Help

character arrays c k&r book 1-17

c arrays kernighan-and-ritchie

I am working through K&amp;R and I've attempted to write a program that prints out all input lines greater than 80 characters. Once I run the program on itself from the terminal I get nothing back....

Netbeans test in Java not printing

java testing netbeans println

In a test class, I'm testing a implementation of a collection. All the assertions work just fine (therefore I know the methods on the class are working as I expect them to work). But everytime I us...