String (Element element) { StringWriter out = new StringWriter(); try { // If this is the root element, we could pre-initialize the namespace stack with the namespaces printElement(out, element, 0, new NamespaceStack()); } catch (IOException ignored) { } return out.toString(); }