ANT build.xml 中 XML 的嵌套形式
我是 ANT 和 XML 的新手。 XML 语法看起来确实很混乱。 以下三个“echo”结构在我的 ANT 中是正确的。
<echo message="Hello "/>
<echo message="Hello "></echo>
<echo> Hello </echo>
但当我使用“fileset”时,
<fileset dir="." includes = "**/*.java" id="myid" />
<fileset dir="." includes = "**/*.java" id="myid2" ></fileset>
仍然正确,但
<fileset> dir="." includes = "**/*.java" id="myid2" </fileset>
被 ANT 认为是错误的:
The <fileset> type doesn't support nested text data ("dir="." ...="myid2"").
是否有一些通用规则来区分标题之间的语法差异,例如 "fileset" 和 "echo “,我的意思是,怎么“echo”允许嵌套文本数据,但“fileset”不允许呢? 谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
echo task 的作者就是以这种双重用途的方式开发的。它可以使用“消息”属性或子文本进行操作。但其他任务(fileset 实际上是一种类型)不支持此类功能。只需阅读官方文档即可了解所有用例。
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.