code: public static XMLStreamException missingRequiredElement(final XMLExtendedStreamReader reader, final Set<?> required) {
          final StringBuilder b = new StringBuilder();
          Iterator<?> iterator = required.iterator();
          while (iterator.hasNext()) {
              final Object o = iterator.next();
              b.append(o.toString());
              if (iterator.hasNext()) {
                  b.append(", ");
              }
          }
          final XMLStreamException ex = ControllerLogger.ROOT_LOGGER.missingRequiredElements(b, reader.getLocation());
  
          Set<String> set = new HashSet<>();
          for (Object o : required) {
              String toString = o.toString();
              set.add(toString);
          }
          return new XMLStreamValidationException(ex.getMessage(),
                                                  ValidationError.from(ex, ErrorType.REQUIRED_ELEMENTS_MISSING)
                                                          .element(reader.getName())
                                                          .alternatives(set),
                                                  ex);
      }
docs: Get an exception reporting a missing, required XML child element.
  @param reader the stream reader
  @param required a set of enums whose toString method returns the
  attribute name
  @return the exception