001/*
002 * (C) Copyright 2012 Nuxeo SA (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Antoine Taillefer
016 */
017package org.nuxeo.ecm.core.io;
018
019import java.io.InputStream;
020import java.io.Serializable;
021
022import org.nuxeo.ecm.core.api.CoreSession;
023import org.nuxeo.ecm.core.api.DocumentModel;
024import org.xml.sax.InputSource;
025
026/**
027 * Handles the XML export of a document.
028 *
029 * @author <a href="mailto:ataillefer@nuxeo.com">Antoine Taillefer</a>
030 * @since 5.6
031 */
032public interface DocumentXMLExporter extends Serializable {
033
034    /**
035     * Exports a document to XML as an {@link InputStream}.
036     *
037     * @param doc the document
038     * @param session the core session
039     * @return the input stream
040     */
041    InputStream exportXML(DocumentModel doc, CoreSession session);
042
043    /**
044     * Exports a document to XML as an {@link InputSource}.
045     *
046     * @param doc the document
047     * @param session the core session
048     * @return the input source
049     */
050    InputSource exportXMLAsInputSource(DocumentModel doc, CoreSession session);
051
052    /**
053     * Exports a document to XML as a byte array.
054     *
055     * @param doc the document
056     * @param session the core session
057     * @return the byte array
058     */
059    byte[] exportXMLAsByteArray(DocumentModel doc, CoreSession session);
060}