protected void updateDtdVersion(IProject project, String dtdVersion, String archetypeVesion) {
    final String tmpPublicId = dtdVersion;
    final String tmpSystemId = dtdVersion.replaceAll("\\.", "_");

    IStructuredModel editModel = null;

    final IFile[] metaFiles = getLiferayMetaFiles(project);

    for (IFile file : metaFiles) {
      try {
        editModel = StructuredModelManager.getModelManager().getModelForEdit(file);

        if (editModel != null && editModel instanceof IDOMModel) {
          final IDOMDocument xmlDocument = ((IDOMModel) editModel).getDocument();
          final DocumentTypeImpl docType = (DocumentTypeImpl) xmlDocument.getDoctype();

          final String publicId = docType.getPublicId();
          final String newPublicId = getNewDoctTypeSetting(publicId, tmpPublicId, publicid_pattern);

          if (newPublicId != null) {
            docType.setPublicId(newPublicId);
          }

          final String systemId = docType.getSystemId();
          final String newSystemId = getNewDoctTypeSetting(systemId, tmpSystemId, systemid_pattern);

          if (newSystemId != null) {
            docType.setSystemId(newSystemId);
          }

          editModel.save();
        }
      } catch (Exception e) {
        final IStatus error =
            ProjectCore.createErrorStatus(
                "Unable to upgrade deployment meta file for " + file.getName(), e);
        ProjectCore.logError(error);
      } finally {
        if (editModel != null) {
          editModel.releaseFromEdit();
        }
      }
    }

    ProjectCore.operate(
        project, UpdateDescriptorVersionOperation.class, archetypeVesion, dtdVersion);
  }