// xElem.appendChild(xDoc.importNode(xNode, true));
xDoc.appendChild(xDoc.importNode(xNode, true));
StringWriter out = new StringWriter();
XMLSerializer serializer = new XMLSerializer(out, new OutputFormat(xDoc));
serializer.serialize(xDoc);
String result = out.toString();
SOSXMLXPath xpath = new SOSXMLXPath(new StringBuffer("<spooler><answer><ERROR code=\"4711\" text=\"ein Fehler\"/></answer></spooler>"));
String astring = xpath.selectSingleNodeValue("//ERROR/@code");