Skip to Main Content
Ant: The Definitive Guide, 2nd Edition
book

Ant: The Definitive Guide, 2nd Edition

by Steve Holzner
April 2005
Intermediate to advanced content levelIntermediate to advanced
336 pages
7h 20m
English
O'Reilly Media, Inc.
Content preview from Ant: The Definitive Guide, 2nd Edition

Chapter 9. XML and XDoclet

XML support is built into Ant, and not only as far as build files go. You can validate XML documents using XML DTDs and schemas using the xmlvalidate task. You can read properties from an XML document using xmlproperty. You can use the xslt/style task to transform XML documents using XSLT. And you can use the antstructure task to generate an XML DTD for all the tasks Ant knows about.

Besides covering these and other XML tasks, I'm going to discuss XDoclet in this chapter. XDoclet is an open source code generation engine that is designed to run in Ant. Using codes that you embed in Java source code, XDoclet can generate code, deployment descriptors such as web.xml, and other artifacts for Web and EJB applications.

I'll also round out the discussion of EJB from the previous chapter by discussing the Ant EJB tasks, a specially designed set of optional tasks for developing Enterprise JavaBeans (EJBs).

Validating XML Documents

You use the xmlvalidate task to validate XML documents with Document Type Definitions (DTDs) or XML schema. Your build process may involve generating XML documents, and it can be worthwhile to test those documents for validity before deploying them (for example, see the section on XDoclet in this chapter. You typically use XDoclet to generate XML documents for deploying web applications, such as web.xml, application.xml, and so on). By default, this task uses the SAX2 parser implementation provided by Sun's JAXP (http://java.sun.com/xml/jaxp/index.jsp ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Ant: The Definitive Guide

Ant: The Definitive Guide

Eric M. Burke, Jesse Tilly
Tomcat: The Definitive Guide, 2nd Edition

Tomcat: The Definitive Guide, 2nd Edition

Jason Brittain, Ian F. Darwin
Ant in Action

Ant in Action

Erik Hatcher, Steve Loughran
CMake Cookbook

CMake Cookbook

Radovan Bast, Roberto Di Remigio

Publisher Resources

ISBN: 0596006098Supplemental ContentErrata Page