Apache Ant/XML Summary

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search

Contents

[edit] Brief Overview of XML

This chapter has a summary of the things you need to know about XML to use Apache Ant. It is not a lot of information and users that are already familiar with HTML will pick up the concepts very quickly.

You do not need to know a lot about XML to use Ant. Just a few syntaxical items.

First, you must be very careful to match up the "begin" and "end" tags. Begin tags start with a "<" and end tags have the same name but start with a "</". Here is an simple example:

  <MyDataElement>
     Data Inside…
  </MyDataElement>

Train your eye to look for the </ that ends a tag. If it does not match up something is wrong. Tags that do not match up will cause errors.

[edit] Data Element Nesting

All XML Data Elements must be paired using matching start and end tags:

  <Parent_XML_Element>
     <Child_XML_Element>
        <Sub_Child_XML_Element>
        </Sub_Child_XML_Element>
     </Child_XML_Element>
  </Parent_XML_Element >

Understanding this paired nesting structure is critical to creating working Ant build files.

[edit] XML Attributes

The XML begin tag may also have attributes.

  <MyTag attribute1="nothing" attribute2="nothing else">Text</MyTag>

[edit] Next Section

Getting Started