@Override
 public void attribute(Name name, String value) throws IOException {
   write(' ');
   if (name.nsUriIndex == -1) {
     localNames[name.localNameIndex].write(this);
   } else writeName(name);
   write(EQUALS);
   doText(value, true);
   write('\"');
 }
 public void attribute(int prefix, String localName, String value) throws IOException {
   write(' ');
   if (prefix == -1) {
     textBuffer.set(localName);
     textBuffer.write(this);
   } else writeName(prefix, localName);
   write(EQUALS);
   doText(value, true);
   write('\"');
 }
  /** Writes a single namespace declaration for the specified prefix. */
  protected final void writeNsDecl(int prefixIndex) throws IOException {
    String p = nsContext.getPrefix(prefixIndex);

    if (p.length() == 0) {
      if (nsContext.getCurrent().isRootElement()
          && nsContext.getNamespaceURI(prefixIndex).length() == 0)
        return; // no point in declaring xmlns="" on the root element
      write(XMLNS_EQUALS);
    } else {
      Encoded e = prefixes[prefixIndex];
      write(XMLNS_COLON);
      write(e.buf, 0, e.len - 1); // skip the trailing ':'
      write(EQUALS);
    }
    doText(nsContext.getNamespaceURI(prefixIndex), true);
    write('\"');
  }
 public void text(String value, boolean needSP) throws IOException {
   closeStartTag();
   if (needSP) write(' ');
   doText(value, false);
 }