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.