Bug 89195 - ant content type over defined for <project> tag
diff --git a/ant/org.eclipse.ant.core/src/org/eclipse/ant/internal/core/contentDescriber/AntHandler.java b/ant/org.eclipse.ant.core/src/org/eclipse/ant/internal/core/contentDescriber/AntHandler.java
index cd8e56c..d3186a6 100644
--- a/ant/org.eclipse.ant.core/src/org/eclipse/ant/internal/core/contentDescriber/AntHandler.java
+++ b/ant/org.eclipse.ant.core/src/org/eclipse/ant/internal/core/contentDescriber/AntHandler.java
@@ -68,6 +68,8 @@
     private boolean fDefaultAttributeFound= false;
     private boolean fTargetFound = false;
 
+    private int fLevel= -1;
+
     /**
      * Creates a new SAX parser for use within this instance.
      * 
@@ -139,6 +141,7 @@
      *      java.lang.String, java.lang.String, org.xml.sax.Attributes)
      */
     public final void startElement(final String uri, final String elementName, final String qualifiedName, final Attributes attributes) throws SAXException {
+    	fLevel++;
         if (fTopElementFound == null) {
             fTopElementFound = elementName;
             if (!hasRootProjectElement()) {
@@ -151,12 +154,20 @@
                 }
             }
         }
-        if (TARGET.equals(elementName)) {
+        if (fLevel == 1 && TARGET.equals(elementName)) {
             fTargetFound= true;
             throw new StopParsingException();
         }
     }
 
+    /* (non-Javadoc)
+     * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
+     */
+    public void endElement(String uri, String localName, String qName) throws SAXException {
+    	super.endElement(uri, localName, qName);
+    	fLevel--;
+    }
+
     protected boolean hasProjectDefaultAttribute() {
         return fDefaultAttributeFound;
     }