001/* 002 * (C) Copyright 2012 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Antoine Taillefer 018 */ 019package org.nuxeo.ecm.core.io; 020 021import java.io.InputStream; 022import java.io.Serializable; 023 024import org.nuxeo.ecm.core.api.CoreSession; 025import org.nuxeo.ecm.core.api.DocumentModel; 026import org.xml.sax.InputSource; 027 028/** 029 * Handles the XML export of a document. 030 * 031 * @author <a href="mailto:ataillefer@nuxeo.com">Antoine Taillefer</a> 032 * @since 5.6 033 */ 034public interface DocumentXMLExporter extends Serializable { 035 036 /** 037 * Exports a document to XML as an {@link InputStream}. 038 * 039 * @param doc the document 040 * @param session the core session 041 * @return the input stream 042 */ 043 InputStream exportXML(DocumentModel doc, CoreSession session); 044 045 /** 046 * Exports a document to XML as an {@link InputSource}. 047 * 048 * @param doc the document 049 * @param session the core session 050 * @return the input source 051 */ 052 InputSource exportXMLAsInputSource(DocumentModel doc, CoreSession session); 053 054 /** 055 * Exports a document to XML as a byte array. 056 * 057 * @param doc the document 058 * @param session the core session 059 * @return the byte array 060 */ 061 byte[] exportXMLAsByteArray(DocumentModel doc, CoreSession session); 062}