protected void writeString(String text) throws IOException {
        if ( text != null && !text.isEmpty()) {
            if ( escapeText ) {
                text = escapeElementEntities(text);
            }

//            if (format.isPadText()) {
//                if (lastOutputNodeType == Node.ELEMENT_NODE) {
//                    writer.write(PAD_TEXT);
//                }
//            }

            if (format.isTrimText()) {
                boolean first = true;
                StringTokenizer tokenizer = new StringTokenizer(text);
                while (tokenizer.hasMoreTokens()) {
                    String token = tokenizer.nextToken();
                    if ( first ) {
                        first = false;
                        if ( lastOutputNodeType == Node.TEXT_NODE ) {
                            writer.write(" ");
                        }
                    }
                    else {
                        writer.write(" ");
                    }
                    writer.write(token);
                    lastOutputNodeType = Node.TEXT_NODE;
                }
            }
            else {
                lastOutputNodeType = Node.TEXT_NODE;
                writer.write(text);
            }
        }
    }
Writes the SAX namepsaces
@param prefix the namespace prefix
@param uri the URL of the namespace
@throws IOException if the namespace could not be written
xmppserver/src/main/java/org/jivesoftware/util/XMLWriter.java