Cari di Apache Ant 
    Apache Ant Tutorial
Daftar Isi
(Sebelumnya) ANTLRAntVersion (Berikutnya)
Apache Ant Tasks

AntStructure

AntStructure

Description

Generates an DTD for Apache Ant buildfiles which contains informationabout all tasks currently known to Ant.

Actually the DTD will not be a real DTD for buildfiles since Ant'susage of XML cannot be captured with a DTD. Several elements in Antcan have different attribute lists depending on the element thatcontains them. "fail" for example can be the task or the nested child element of the sound task. Don't consider thegenerated DTD something to rely upon.

Also note that the DTD generated by this task is incomplete, you canalways add XML entities using <taskdef> or <typedef>. See here for a way to get around this problem.

This task doesn't know about required attributes, all will belisted as #IMPLIED.

Since Ant 1.7 custom structure printers can be usedinstead of the one that emits a DTD. In order to plug in your ownstructure, you have to implement the interfaceorg.apache.tools.ant.taskdefs.AntStructure.StructurePrinterand <typedef> your class and use the new type as a nestedelement of this task - see the example below.

Parameters

Attribute Description Required
output file to write the DTD to. Yes

Examples

<antstructure output="project.dtd" />

Emitting your own structure instead of a DTD

First you need to implement the interface

package org.example;import org.apache.tools.ant.taskdefs.AntStructure;public class MyPrinter implements AntStructure.StructurePrinter { ...}

and then use it via typedef

  <typedef name="myprinter" classname="org.example.MyPrinter" />  <antstructure output="project.my"> <myprinter />  </antstructure>

Your own StructurePrinter can accept attributes and nested elementsjust like any other Ant type or task.

(Sebelumnya) ANTLRAntVersion (Berikutnya)