public XmlSerializer attribute(
            String namespace,
            String name,
            String value)
            throws IOException {
        if (!pending) {
            throw new IllegalStateException("illegal position for attribute");
        }

        //        int cnt = nspCounts[depth];

        if (namespace == null) {
            namespace = "";
        }

        //        depth--;
        //        pending = false;

        String prefix =
                StringUtils.isEmpty(namespace)
                        ? ""
                        : getPrefix(namespace, false, true);

        //        pending = true;
        //        depth++;

        /*
         * if (cnt != nspCounts[depth]) {
         * writer.write(' ');
         * writer.write("xmlns");
         * if (nspStack[cnt * 2] != null) {
         * writer.write(':');
         * writer.write(nspStack[cnt * 2]);
         * }
         * writer.write("=\"");
         * writeEscaped(nspStack[cnt * 2 + 1], '"');
         * writer.write('"');
         * }
         */

        writer.write(' ');
        if (StringUtils.isNotEmpty(prefix)) {
            writer.write(prefix);
            writer.write(':');
        }
        writer.write(name);
        writer.write('=');
        char q = value.indexOf('"') == -1 ? '"' : '\'';
        writer.write(q);
        writeEscaped(value, q);
        writer.write(q);

        return this;
    }
size (in characters) for the write buffer
main/thirdparty/cgeo/org/kxml2/io/KXmlSerializer.java