Converting partial XML (Node List) to a String
Reading the documentation for
Transformer,
where it says:


  A Transformer may be used multiple times. Parameters and output
  properties are preserved across transformations.


, I'd say that not only can the Transformer object be reused across
multiple nodes, but you should also be able to use a single
StringWriter instead of recreating it for every node; same goes for
the DOMSource actually:

private static String nodeListToString(NodeList nodes) throws TransformerException {
    DOMSource source = new DOMSource();
    StringWriter writer = new StringWriter();
    StreamResult result = new StreamResult(writer);
    Transformer transformer = TransformerFactory.newInstance().newTransformer();
    transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");

    for (int i = 0; i &lt; nodes.getLength(); ++i) {
        source.setNode(nodes.item(i));
        transformer.transform(source, result);
    }

    return writer.toString();
}


That said, I'm only guessing that this should work.

Also, the len variable is probably going to be inlined automatically
anyway, though you could check that with a disassembler just to be sure
(it wouldn't make that much of a difference I suspect).

Otherwise looks good to me; if you've tested it with all kinds of node types and the output looks good, then I'd say that should work IMHO.