public static <T> void writeListTo(XMLStreamWriter writer, List<T> messages, Schema<T> schema)
            throws IOException, XMLStreamException
    {
        writer.writeStartElement("list");

        if (messages.isEmpty())
        {
            writer.writeEndElement();
            return;
        }

        final String simpleName = schema.messageName();
        final XmlOutput output = new XmlOutput(writer, schema);
        for (T m : messages)
        {
            writer.writeStartElement(simpleName);
            schema.writeTo(output, m);
            writer.writeEndElement();
        }

        writer.writeEndElement();
    }
Serializes the {@code messages} into the {@link XMLStreamWriter} using the given schema.
protostuff-xml/src/main/java/io/protostuff/XmlIOUtil.java