Build the antstructure DTD.
if (output == null) {
throw new BuildException("output attribute is required", getLocation());
}
PrintWriter out = null;
try {
try {
out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(output), "UTF8"));
} catch (UnsupportedEncodingException ue) {
/*
* Plain impossible with UTF8, see
* http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html
*
* fallback to platform specific anyway.
*/
out = new PrintWriter(new FileWriter(output));
}
printer.printHead(out, getProject(),
getProject().getTaskDefinitions(),
getProject().getDataTypeDefinitions());
printer.printTargetDecl(out);
Enumeration dataTypes = getProject().getDataTypeDefinitions().keys();
while (dataTypes.hasMoreElements()) {
String typeName = (String) dataTypes.nextElement();
printer.printElementDecl(
out, getProject(), typeName,
(Class) getProject().getDataTypeDefinitions().get(typeName));
}
Enumeration tasks = getProject().getTaskDefinitions().keys();
while (tasks.hasMoreElements()) {
String tName = (String) tasks.nextElement();
printer.printElementDecl(out, getProject(), tName,
(Class) getProject().getTaskDefinitions().get(tName));
}
printer.printTail(out);
} catch (IOException ioe) {
throw new BuildException("Error writing "
+ output.getAbsolutePath(), ioe, getLocation());
} finally {
if (out != null) {
out.close();
}
}