code: private Attributes createAttributes(Map<String, String> parameters)
      {
          AttributesImpl attributes = new AttributesImpl();
  
          if (parameters != null && !parameters.isEmpty()) {
              for (Map.Entry<String, String> entry : parameters.entrySet()) {
                  String value = entry.getValue();
                  String key = entry.getKey();
  
                  if (key != null && value != null) {
                      attributes.addAttribute(null, null, key, null, value);
                  }
              }
          }
  
          return attributes;
      }
docs: Convert provided map into {@link Attributes} to use in xml writer.