Code example for DOMSource

0
                oprops.put(OutputKeys.METHOD, "xml");
                oprops.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
                oprops.put(OutputKeys.VERSION, "1.0");
                oprops.put(OutputKeys.INDENT, "true");
                serializer.setOutputProperties(oprops);
                serializer.transform(new DOMSource(doc), new StreamResult(XMLStream));
 
            } catch (Exception ex) {
                IOException iox = new IOException("Problem during conversion");
                iox.initCause(ex);
                throw iox;
            } 
        } 
 
        if (logger.isLoggable(Level.FINER)) {
            logger.exiting(className, "toXml(InputStream, OutputStream)");
        } 
    } 
 
    /** 
     * Method to take an input stream to an JSON document and return a String of the XML format.