private void printAttributes(Writer out, List<? extends Attribute> attributes, NamespaceStack 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();
    for (int i = 0; i < attributes.size(); i++) {
      Attribute attribute = attributes.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("\"");
    }
  }
private void printAttributes(Writer out, List<? extends Attribute> attributes, NamespaceStack namespaces)