How can I get xml text of the nodeinfo (like node.asXML() in dom4j)?
Create a serializer and then write the node to the serializer:
public static String serialize(NodeInfo nodeInfo) throws XPathException {
Configuration config = nodeInfo.getConfiguration();
StringWriter sw = new StringWriter();
Properties props = new Properties();
props.setProperty("method", "xml");
props.setProperty("indent", "yes");
Receiver serializer = config.getSerializerFactory().getReceiver(
new StreamResult(sw),
config.makePipelineConfiguration(),
props);
nodeInfo.copy(serializer, NodeInfo.ALL_NAMESPACES, true, 0);
return sw.toString();
}