Package org.restlet.util

Examples of org.restlet.util.XmlWriter


* @contributor nlevitt
*/
public class XmlMarshaller {
   
    protected static XmlWriter getXmlWriter(Writer writer) {
        XmlWriter xmlWriter = new XmlWriter(writer);

        // https://webarchive.jira.com/browse/HER-1603?focusedCommentId=22558#action_22558
        xmlWriter.setDataFormat(true);
        xmlWriter.setIndentStep(2);

        return xmlWriter;
    }
View Full Code Here


     *            data structure to marshal
     * @throws IOException
     */
    public static void marshalDocument(Writer writer, String rootTag,
            Object content) throws IOException {
        XmlWriter xmlWriter = getXmlWriter(writer);
        try {
            xmlWriter.startDocument();
            marshal(xmlWriter, rootTag, content);
            xmlWriter.endDocument(); // calls flush()
        } catch (SAXException e) {
            if (e.getException() instanceof IOException) {
                // e.g. broken tcp connection
                throw (IOException) e.getException()
            } else {
View Full Code Here

TOP

Related Classes of org.restlet.util.XmlWriter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.