String returnString = null;
StringWriter outString = new StringWriter();
XMLSerializer xsl = new XMLSerializer(outString, format);
try {
if (node.getNodeType() == Node.DOCUMENT_NODE) {
xsl.serialize((Document)node);
returnString = outString.toString();
} else if (node.getNodeType() == Node.ELEMENT_NODE) {
xsl.serialize((Element)node);
returnString = outString.toString();
} else {