@Override
  public void startElement(String uri, String localName, String name, Attributes attributes)
      throws SAXException {
    if ("module".equals(name)) {
      String moduleName = attributes.getValue("name");
      module = new Module(moduleName);
    } else if ("directive".equals(name)) {

      String directiveName = attributes.getValue("name");
      String url = attributes.getValue("url");
      AngularType directiveType = AngularType.get(attributes.getValue("type"));
      // tags name
      List<String> tagsName = new ArrayList<String>();
      String tags = attributes.getValue("tags");
      if (!StringUtils.isEmpty(tags)) {
        String[] names = tags.split(",");
        String tagName = null;

        for (int i = 0; i < names.length; i++) {
          tagName = names[i].trim();
          if (tagName.length() > 0) {
            tagsName.add(tagName);
          }
        }
      }
      // restrict
      String restrict = attributes.getValue("restrict");
      // value : required|optional|none
      DirectiveValue directiveValue = DirectiveValue.get(attributes.getValue("value"));
      this.directive =
          new Directive(
              directiveName, directiveType, url, tagsName, restrict, directiveValue, module, false);
    } else if ("description".equals(name)) {
      this.description = new StringBuilder();
    } else if ("parameter".equals(name)) {
      String parameterName = attributes.getValue("name");
      boolean optional = StringUtils.asBoolean(attributes.getValue("optional"), false);
      this.directiveParameter = new DirectiveParameter(parameterName, optional, directive);
      directive.addParameter(directiveParameter);
      this.description = new StringBuilder();
    }
    super.startElement(uri, localName, name, attributes);
  }