@Override
  public void readElement(final XMLExtendedStreamReader reader, final FeaturePackDescription result)
      throws XMLStreamException {

    final Set<Attribute> required = EnumSet.noneOf(Attribute.class);
    final int count = reader.getAttributeCount();

    for (int i = 0; i < count; i++) {
      throw ParsingUtils.unexpectedContent(reader);
    }
    if (!required.isEmpty()) {
      throw ParsingUtils.missingAttributes(reader.getLocation(), required);
    }
    while (reader.hasNext()) {
      switch (reader.nextTag()) {
        case XMLStreamConstants.END_ELEMENT:
          {
            return;
          }
        case XMLStreamConstants.START_ELEMENT:
          {
            final Element element = Element.of(reader.getName());

            switch (element) {
              case DEPENDENCIES:
                parseDependencies(reader, result);
                break;
              case ARTIFACT_VERSIONS:
                parseArtifactVersions(reader, result);
                break;
              case CONFIG:
                configModelParser.parseConfig(reader, result.getConfig());
                break;
              case COPY_ARTIFACTS:
                copyArtifactsModelParser.parseCopyArtifacts(reader, result.getCopyArtifacts());
                break;
              case FILE_PERMISSIONS:
                filePermissionsModelParser.parseFilePermissions(
                    reader, result.getFilePermissions());
                break;
              default:
                throw ParsingUtils.unexpectedContent(reader);
            }
            break;
          }
        default:
          {
            throw ParsingUtils.unexpectedContent(reader);
          }
      }
    }
    throw ParsingUtils.endOfDocument(reader.getLocation());
  }
 private String parseName(final XMLStreamReader reader) throws XMLStreamException {
   final int count = reader.getAttributeCount();
   String name = null;
   final Set<Attribute> required = EnumSet.of(Attribute.NAME);
   for (int i = 0; i < count; i++) {
     final Attribute attribute = Attribute.of(reader.getAttributeName(i));
     required.remove(attribute);
     switch (attribute) {
       case NAME:
         name = reader.getAttributeValue(i);
         break;
       default:
         throw ParsingUtils.unexpectedContent(reader);
     }
   }
   if (!required.isEmpty()) {
     throw ParsingUtils.missingAttributes(reader.getLocation(), required);
   }
   ParsingUtils.parseNoContent(reader);
   return propertyReplacer.replaceProperties(name);
 }
 private Artifact parseArtifact(final XMLStreamReader reader) throws XMLStreamException {
   final int count = reader.getAttributeCount();
   String groupId = null;
   String artifactId = null;
   String version = null;
   String classifier = null;
   String extension = null;
   final Set<Attribute> required =
       EnumSet.of(Attribute.GROUP_ID, Attribute.ARTIFACT_ID, Attribute.VERSION);
   for (int i = 0; i < count; i++) {
     final Attribute attribute = Attribute.of(reader.getAttributeName(i));
     required.remove(attribute);
     switch (attribute) {
       case GROUP_ID:
         groupId = propertyReplacer.replaceProperties(reader.getAttributeValue(i));
         break;
       case ARTIFACT_ID:
         artifactId = propertyReplacer.replaceProperties(reader.getAttributeValue(i));
         break;
       case VERSION:
         version = propertyReplacer.replaceProperties(reader.getAttributeValue(i));
         break;
       case CLASSIFIER:
         classifier = propertyReplacer.replaceProperties(reader.getAttributeValue(i));
         break;
       case EXTENSION:
         extension = propertyReplacer.replaceProperties(reader.getAttributeValue(i));
         break;
       default:
         throw ParsingUtils.unexpectedContent(reader);
     }
   }
   if (!required.isEmpty()) {
     throw ParsingUtils.missingAttributes(reader.getLocation(), required);
   }
   ParsingUtils.parseNoContent(reader);
   return new Artifact(groupId, artifactId, classifier, extension, version);
 }