protected void printAttributes(Writer out, List attributes, Element parent,
                                 EclipseNamespaceStack namespaces)
    throws IOException {

    // I do not yet handle the case where the same prefix maps to
    // two different URIs. For attributes on the same element
    // this is illegal; but as yet we don't throw an exception
    // if someone tries to do this
    // Set prefixes = new HashSet();
    List<Attribute> atts = new ArrayList<>();
    for (Object attribute : attributes) {
      atts.add((Attribute)((Attribute)attribute).clone());
    }
    Collections.sort(atts, (o1, o2) -> o1.getName().compareTo(o2.getName()));
    for (int i = 0; i < atts.size(); i++) {
      Attribute attribute = (Attribute)atts.get(i);
      Namespace ns = attribute.getNamespace();
      if ((ns != Namespace.NO_NAMESPACE) &&
          (ns != Namespace.XML_NAMESPACE)) {
        printNamespace(out, ns, namespaces);
      }

      out.write(" ");
      printQualifiedName(out, attribute);
      out.write("=");

      out.write("\"");
      out.write(escapeAttributeEntities(attribute.getValue()));
      out.write("\"");
    }
  }
protected void printAttributes(Writer out, List attributes, Element parent,
                                 EclipseNamespaceStack namespaces)