code: public static String marshal(Document document, String encoding) throws CmsXmlException {
  
          ByteArrayOutputStream out = new ByteArrayOutputStream();
          marshal(document, out, encoding);
          try {
              return out.toString(encoding);
          } catch (UnsupportedEncodingException e) {
              throw new CmsXmlException(Messages.get().container(Messages.ERR_MARSHALLING_XML_DOC_TO_STRING_0), e);
          }
      }
docs: Marshals (writes) an XML document to a String using XML pretty-print formatting.<p>
  
  @param document the XML document to marshal
  @param encoding the encoding to use
  @return the marshalled XML document
  @throws CmsXmlException if something goes wrong