protected void validate(List<Element> children, Set<String> elNames) throws PortalException {

    for (Element el : children) {
      if (el.getName().equals("meta-data")) {
        continue;
      }

      String elName = el.attributeValue("name", StringPool.BLANK);
      String elType = el.attributeValue("type", StringPool.BLANK);

      if (Validator.isNull(elName) || elName.startsWith(JournalStructureConstants.RESERVED)) {

        throw new StructureXsdException();
      } else {
        char[] c = elName.toCharArray();

        for (int i = 0; i < c.length; i++) {
          if ((!Validator.isChar(c[i]))
              && (!Validator.isDigit(c[i]))
              && (c[i] != CharPool.DASH)
              && (c[i] != CharPool.UNDERLINE)) {

            throw new StructureXsdException();
          }
        }

        String completePath = elName;

        Element parent = el.getParent();

        while (!parent.isRootElement()) {
          completePath =
              parent.attributeValue("name", StringPool.BLANK) + StringPool.SLASH + completePath;

          parent = parent.getParent();
        }

        String elNameLowerCase = completePath.toLowerCase();

        if (elNames.contains(elNameLowerCase)) {
          throw new StructureXsdException();
        } else {
          elNames.add(elNameLowerCase);
        }
      }

      if (Validator.isNull(elType)) {
        throw new StructureXsdException();
      }

      validate(el.elements(), elNames);
    }
  }