public void write(Object object) throws IOException {
        if (object instanceof Node) {
            write((Node) object);
        }
        else if (object instanceof String) {
            write((String) object);
        }
        else if (object instanceof List) {
            List list = (List) object;
            for ( int i = 0, size = list.size(); i < size; i++ ) {
                write( list.get(i) );
            }
        }
        else if (object != null) {
            throw new IOException( "Invalid object: " + object );
        }
    }
Writes the given object which should be a String, a Node or a List
of Nodes.

@param object is the object to output.
@throws IOException if the object could not be written
xmppserver/src/main/java/org/jivesoftware/util/XMLWriter.java