/** @param element */
 private void validatePlugins(Element parent) {
   NodeList list = getChildrenByName(parent, "plugin"); // $NON-NLS-1$
   for (int i = 0; i < list.getLength(); i++) {
     if (fMonitor.isCanceled()) return;
     Element plugin = (Element) list.item(i);
     assertAttributeDefined(plugin, "id", CompilerFlags.ERROR); // $NON-NLS-1$
     assertAttributeDefined(plugin, "version", CompilerFlags.ERROR); // $NON-NLS-1$
     NamedNodeMap attributes = plugin.getAttributes();
     boolean isFragment =
         plugin.getAttribute("fragment").equals("true"); // $NON-NLS-1$ //$NON-NLS-2$
     for (int j = 0; j < attributes.getLength(); j++) {
       Attr attr = (Attr) attributes.item(j);
       String name = attr.getName();
       if (name.equals("id")) { // $NON-NLS-1$
         validatePluginID(plugin, attr, isFragment);
       } else if (name.equals("version")) { // $NON-NLS-1$
         validateVersionAttribute(plugin, attr);
         validateVersion(plugin, attr);
       } else if (name.equals("fragment") || name.equals("unpack")) { // $NON-NLS-1$ //$NON-NLS-2$
         validateBoolean(plugin, attr);
       } else if (!name.equals("os")
           && !name.equals("ws")
           && !name.equals("nl") // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
           && !name.equals("arch")
           && !name.equals("download-size") // $NON-NLS-1$ //$NON-NLS-2$
           && !name.equals("install-size")
           && !name.equals("filter")) { // $NON-NLS-1$ //$NON-NLS-2$
         reportUnknownAttribute(plugin, name, CompilerFlags.ERROR);
       }
     }
     validateUnpack(plugin);
   }
 }
 private void validateImports(Element parent) {
   NodeList list = getChildrenByName(parent, "import"); // $NON-NLS-1$
   for (int i = 0; i < list.getLength(); i++) {
     if (fMonitor.isCanceled()) return;
     Element element = (Element) list.item(i);
     Attr plugin = element.getAttributeNode("plugin"); // $NON-NLS-1$
     Attr feature = element.getAttributeNode("feature"); // $NON-NLS-1$
     if (plugin == null && feature == null) {
       assertAttributeDefined(element, "plugin", CompilerFlags.ERROR); // $NON-NLS-1$
     } else if (plugin != null && feature != null) {
       reportExclusiveAttributes(
           element, "plugin", "feature", CompilerFlags.ERROR); // $NON-NLS-1$//$NON-NLS-2$
     } else if (plugin != null) {
       validatePluginID(element, plugin, false);
     } else if (feature != null) {
       validateFeatureID(element, feature);
     }
     NamedNodeMap attributes = element.getAttributes();
     for (int j = 0; j < attributes.getLength(); j++) {
       Attr attr = (Attr) attributes.item(j);
       String name = attr.getName();
       if (name.equals("version")) { // $NON-NLS-1$
         validateVersionAttribute(element, attr);
       } else if (name.equals("match")) { // $NON-NLS-1$
         if (element.getAttributeNode("patch") != null) { // $NON-NLS-1$
           report(
               NLS.bind(PDECoreMessages.Builders_Feature_patchedMatch, attr.getValue()),
               getLine(element, attr.getValue()),
               CompilerFlags.ERROR,
               PDEMarkerFactory.CAT_FATAL);
         } else {
           validateMatch(element, attr);
         }
       } else if (name.equals("patch")) { // $NON-NLS-1$
         if ("true".equalsIgnoreCase(attr.getValue()) && feature == null) { // $NON-NLS-1$
           report(
               NLS.bind(PDECoreMessages.Builders_Feature_patchPlugin, attr.getValue()),
               getLine(element, attr.getValue()),
               CompilerFlags.ERROR,
               PDEMarkerFactory.CAT_FATAL);
         } else if ("true".equalsIgnoreCase(attr.getValue())
             && element.getAttributeNode("version") == null) { // $NON-NLS-1$ //$NON-NLS-2$
           report(
               NLS.bind(PDECoreMessages.Builders_Feature_patchedVersion, attr.getValue()),
               getLine(element, attr.getValue()),
               CompilerFlags.ERROR,
               PDEMarkerFactory.CAT_FATAL);
         } else {
           validateBoolean(element, attr);
         }
       } else if (!name.equals("plugin")
           && !name.equals("feature")
           && !name.equals("filter")) { // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
         reportUnknownAttribute(element, name, CompilerFlags.ERROR);
       }
     }
   }
 }
 private void validateInstallHandler(Element element) {
   NodeList elements = getChildrenByName(element, "install-handler"); // $NON-NLS-1$
   if (elements.getLength() > 0) {
     if (fMonitor.isCanceled()) return;
     Element handler = (Element) elements.item(0);
     NamedNodeMap attributes = handler.getAttributes();
     for (int i = 0; i < attributes.getLength(); i++) {
       String name = attributes.item(i).getNodeName();
       if (!name.equals("library") && !name.equals("handler")) // $NON-NLS-1$ //$NON-NLS-2$
       reportUnknownAttribute(handler, name, CompilerFlags.ERROR);
     }
     reportExtraneousElements(elements, 1);
   }
 }
 private void validateUpdateURL(Element parent) {
   NodeList list = getChildrenByName(parent, "update"); // $NON-NLS-1$
   if (list.getLength() > 0) {
     if (fMonitor.isCanceled()) return;
     Element update = (Element) list.item(0);
     assertAttributeDefined(update, "url", CompilerFlags.ERROR); // $NON-NLS-1$
     NamedNodeMap attributes = update.getAttributes();
     for (int i = 0; i < attributes.getLength(); i++) {
       String name = attributes.item(i).getNodeName();
       if (name.equals("url")) { // $NON-NLS-1$
         validateURL(update, "url"); // $NON-NLS-1$
       } else if (!name.equals("label")) { // $NON-NLS-1$
         reportUnknownAttribute(update, name, CompilerFlags.ERROR);
       }
     }
     reportExtraneousElements(list, 1);
   }
 }
 private void validateDescription(Element parent) {
   NodeList list = getChildrenByName(parent, "description"); // $NON-NLS-1$
   if (list.getLength() > 0) {
     if (fMonitor.isCanceled()) return;
     Element element = (Element) list.item(0);
     validateElementWithContent((Element) list.item(0), true);
     NamedNodeMap attributes = element.getAttributes();
     for (int i = 0; i < attributes.getLength(); i++) {
       Attr attr = (Attr) attributes.item(i);
       String name = attr.getName();
       if (name.equals("url")) { // $NON-NLS-1$
         validateURL(element, name);
       } else {
         reportUnknownAttribute(element, name, CompilerFlags.ERROR);
       }
     }
     reportExtraneousElements(list, 1);
   }
 }
  private void validateIncludes(Element parent) {
    NodeList list = getChildrenByName(parent, "includes"); // $NON-NLS-1$
    for (int i = 0; i < list.getLength(); i++) {
      if (fMonitor.isCanceled()) return;
      Element include = (Element) list.item(i);
      if (assertAttributeDefined(include, "id", CompilerFlags.ERROR) // $NON-NLS-1$
          && assertAttributeDefined(
              include,
              "version", //$NON-NLS-1$
              CompilerFlags.ERROR)) {

        validateFeatureID(include, include.getAttributeNode("id")); // $NON-NLS-1$
      }
      NamedNodeMap attributes = include.getAttributes();
      for (int j = 0; j < attributes.getLength(); j++) {
        Attr attr = (Attr) attributes.item(j);
        String name = attr.getName();
        if (name.equals("version")) { // $NON-NLS-1$
          validateVersionAttribute(include, attr);
        } else if (name.equals("optional")) { // $NON-NLS-1$
          validateBoolean(include, attr);
        } else if (name.equals("search-location")) { // $NON-NLS-1$
          String value = include.getAttribute("search-location"); // $NON-NLS-1$
          if (!value.equals("root")
              && !value.equals("self")
              && !value.equals("both")) { // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            reportIllegalAttributeValue(include, attr);
          }
        } else if (!name.equals("id")
            && !name.equals("name")
            && !name.equals("os")
            && !name.equals("ws") // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
            && !name.equals("nl")
            && !name.equals("arch")
            && !name.equals("filter")) { // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
          reportUnknownAttribute(include, name, CompilerFlags.ERROR);
        }
      }
    }
  }
 private void validateData(Element parent) {
   NodeList list = getChildrenByName(parent, "data"); // $NON-NLS-1$
   for (int i = 0; i < list.getLength(); i++) {
     if (fMonitor.isCanceled()) return;
     Element data = (Element) list.item(i);
     assertAttributeDefined(data, "id", CompilerFlags.ERROR); // $NON-NLS-1$
     NamedNodeMap attributes = data.getAttributes();
     for (int j = 0; j < attributes.getLength(); j++) {
       Attr attr = (Attr) attributes.item(j);
       String name = attr.getName();
       if (!name.equals("id")
           && !name.equals("os")
           && !name.equals("ws") // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
           && !name.equals("nl")
           && !name.equals("arch") // $NON-NLS-1$ //$NON-NLS-2$
           && !name.equals("download-size")
           && !name.equals("install-size")) { // $NON-NLS-1$ //$NON-NLS-2$
         reportUnknownAttribute(data, name, CompilerFlags.ERROR);
       }
     }
   }
 }
 private void validateDiscoveryURL(Element parent) {
   NodeList list = getChildrenByName(parent, "discovery"); // $NON-NLS-1$
   if (list.getLength() > 0) {
     if (fMonitor.isCanceled()) return;
     Element discovery = (Element) list.item(0);
     assertAttributeDefined(discovery, "url", CompilerFlags.ERROR); // $NON-NLS-1$
     NamedNodeMap attributes = discovery.getAttributes();
     for (int i = 0; i < attributes.getLength(); i++) {
       String name = attributes.item(i).getNodeName();
       if (name.equals("url")) { // $NON-NLS-1$
         validateURL(discovery, "url"); // $NON-NLS-1$
       } else if (name.equals("type")) { // $NON-NLS-1$
         String value = discovery.getAttribute("type"); // $NON-NLS-1$
         if (!value.equals("web") && !value.equals("update")) { // $NON-NLS-1$ //$NON-NLS-2$
           reportIllegalAttributeValue(discovery, (Attr) attributes.item(i));
         }
         reportDeprecatedAttribute(discovery, discovery.getAttributeNode("type")); // $NON-NLS-1$
       } else if (!name.equals("label")) { // $NON-NLS-1$
         reportUnknownAttribute(discovery, name, CompilerFlags.ERROR);
       }
     }
   }
 }
 private void validateFeatureAttributes(Element element) {
   if (fMonitor.isCanceled()) return;
   assertAttributeDefined(element, "id", CompilerFlags.ERROR); // $NON-NLS-1$
   assertAttributeDefined(element, "version", CompilerFlags.ERROR); // $NON-NLS-1$
   NamedNodeMap attributes = element.getAttributes();
   for (int i = 0; i < attributes.getLength(); i++) {
     String name = attributes.item(i).getNodeName();
     if (!attrs.contains(name)) {
       reportUnknownAttribute(element, name, CompilerFlags.ERROR);
     } else if (name.equals("id")) { // $NON-NLS-1$
       validatePluginID(element, (Attr) attributes.item(i));
     } else if (name.equals("primary") || name.equals("exclusive")) { // $NON-NLS-1$ //$NON-NLS-2$
       validateBoolean(element, (Attr) attributes.item(i));
     } else if (name.equals("version")) { // $NON-NLS-1$
       validateVersionAttribute(element, (Attr) attributes.item(i));
     }
     if (name.equals("primary")) { // $NON-NLS-1$
       reportDeprecatedAttribute(element, (Attr) attributes.item(i));
     } else if (name.equals("plugin")) { // $NON-NLS-1$
       validatePluginID(element, (Attr) attributes.item(i), false);
     }
   }
 }