code: public void addClassElement(final String className, final MetadataElement classElement) {
          classElement.setType(getNamespaceValue(classElement.getType()));
  
          if (classElement.getMaxOccurs() != null && !classElement.getMaxOccurs().equals("1")) {
              classElement.setMaxOccurs("unbounded");
          }
  
          for (MetadataItem item : classList) {
              if (item.getName().equals(className) && item.getNamespace().equals(getCurrentNamespace())
                  && item.getPackageApi().equals(getCurrentPackageApi())) {
                  // check for a element with the same name, if found then set 'maxOccurs = unbounded'
                  for (MetadataElement element : item.getElements()) {
                      if (element.getName().equals(classElement.getName()) && !classElement.getIsAttribute()) {
                          element.setMaxOccurs("unbounded");
                          return;
                      }
                  }
  
                  item.getElements().add(classElement);
                  return;
              }
          }
  
          final MetadataItem newItem = new MetadataItem(className);
          newItem.getElements().add(classElement);
          newItem.setNamespace(getCurrentNamespace());
          newItem.setSchemaName(getCurrentSchmema());
          newItem.setPackageApi(getCurrentPackageApi());
          newItem.setPackageImpl(getCurrentPackageImpl());
          classList.add(newItem);
      }
docs: Adds a new element to the specific element class. If no element class is found, then a new element class. will be
  created.
  
  @param className
  the class name
  @param classElement
  the new element to be added.