2006-09-11 04:19:00 +00:00
|
|
|
<!--
|
|
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
contributor license agreements. See the NOTICE file distributed with
|
|
|
|
this work for additional information regarding copyright ownership.
|
|
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
(the "License"); you may not use this file except in compliance with
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
-->
|
2001-02-13 12:32:01 +00:00
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Language" content="en-us">
|
2005-04-29 18:58:16 +00:00
|
|
|
<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
2002-02-03 22:00:42 +00:00
|
|
|
<title>AntStructure Task</title>
|
2001-02-13 12:32:01 +00:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h2 id="antstructure">AntStructure</h2>
|
|
|
|
<h3>Description</h3>
|
2004-04-06 13:48:22 +00:00
|
|
|
|
2010-11-11 17:04:16 +00:00
|
|
|
<p>Generates an DTD for Apache Ant buildfiles which contains information
|
2004-04-06 13:48:22 +00:00
|
|
|
about all tasks currently known to Ant.</p>
|
|
|
|
|
|
|
|
<p>Actually the DTD will not be a real DTD for buildfiles since Ant's
|
|
|
|
usage of XML cannot be captured with a DTD. Several elements in Ant
|
|
|
|
can have different attribute lists depending on the element that
|
|
|
|
contains them. "fail" for example can be <a
|
|
|
|
href="fail.html">the task</a> or the nested child element of the <a
|
2010-05-26 20:33:51 +00:00
|
|
|
href="../Tasks/sound.html">sound</a> task. Don't consider the
|
2004-04-06 13:48:22 +00:00
|
|
|
generated DTD something to rely upon.</p>
|
|
|
|
|
|
|
|
<p>Also note that the DTD generated by this task is incomplete, you can
|
2001-02-13 12:32:01 +00:00
|
|
|
always add XML entities using <a
|
2002-04-10 10:02:54 +00:00
|
|
|
href="taskdef.html"><code><taskdef></code></a> or <a
|
|
|
|
href="typedef.html"><code><typedef></code></a>. See <a
|
|
|
|
href="http://www.sdv.fr/pages/casa/html/ant-dtd.en.html"
|
|
|
|
target="_top">here</a> for a way to get around this problem.</p>
|
2001-02-13 12:32:01 +00:00
|
|
|
<p>This task doesn't know about required attributes, all will be
|
|
|
|
listed as <code>#IMPLIED</code>.</p>
|
2005-09-28 18:34:04 +00:00
|
|
|
|
|
|
|
<p><em>Since Ant 1.7</em> custom structure printers can be used
|
|
|
|
instead of the one that emits a DTD. In order to plug in your own
|
|
|
|
structure, you have to implement the interface
|
|
|
|
<code>org.apache.tools.ant.taskdefs.AntStructure.StructurePrinter</code>
|
2018-01-22 23:52:21 +01:00
|
|
|
and <code><typedef></code> your class and use the new type as a nested
|
|
|
|
element of this task - see the example below.
|
2005-09-28 18:34:04 +00:00
|
|
|
|
2001-02-13 12:32:01 +00:00
|
|
|
<h3>Parameters</h3>
|
2018-01-22 23:52:21 +01:00
|
|
|
<table>
|
2001-02-13 12:32:01 +00:00
|
|
|
<tr>
|
|
|
|
<td valign="top"><b>Attribute</b></td>
|
|
|
|
<td valign="top"><b>Description</b></td>
|
|
|
|
<td align="center" valign="top"><b>Required</b></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">output</td>
|
|
|
|
<td valign="top">file to write the DTD to.</td>
|
|
|
|
<td valign="top" align="center">Yes</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<h3>Examples</h3>
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre><antstructure output="project.dtd"/></pre>
|
2005-09-28 18:34:04 +00:00
|
|
|
|
|
|
|
<p><b>Emitting your own structure instead of a DTD</b></p>
|
|
|
|
|
|
|
|
<p>First you need to implement the interface</p>
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
package org.example;
|
|
|
|
import org.apache.tools.ant.taskdefs.AntStructure;
|
|
|
|
public class MyPrinter implements AntStructure.StructurePrinter {
|
|
|
|
...
|
|
|
|
}
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
<p>and then use it via typedef</p>
|
|
|
|
|
|
|
|
<pre>
|
2006-11-15 16:12:22 +00:00
|
|
|
<typedef name="myprinter" classname="org.example.MyPrinter" />
|
2005-09-28 18:34:04 +00:00
|
|
|
<antstructure output="project.my">
|
2006-11-15 16:12:22 +00:00
|
|
|
<myprinter />
|
|
|
|
</antstructure>
|
2005-09-28 18:34:04 +00:00
|
|
|
</pre>
|
|
|
|
|
|
|
|
<p>Your own StructurePrinter can accept attributes and nested elements
|
|
|
|
just like any other Ant type or task.</p>
|
|
|
|
|
2001-02-13 12:32:01 +00:00
|
|
|
</body>
|
|
|
|
</html>
|