Search in sources :

Example 6 with DocumentInstanceInputProperties

use of org.xwiki.filter.instance.input.DocumentInstanceInputProperties in project xwiki-platform by xwiki.

the class XWikiAttachment method toXML.

/**
 * Write an XML representation of the attachment into an {@link com.xpn.xwiki.internal.xml.XMLWriter}
 *
 * @param out the output where to write the XML
 * @param bWithAttachmentContent if true, binary content of the attachment is included (base64 encoded)
 * @param bWithVersions if true, all archive version is also included
 * @param format true if the XML should be formated
 * @param encoding the encoding to use when serializing XML
 * @throws XWikiException when an error occurs during xwiki operation
 * @since 9.10RC1
 */
public void toXML(OutputTarget out, boolean bWithAttachmentContent, boolean bWithVersions, boolean format, String encoding) throws XWikiException {
    // Input
    DocumentInstanceInputProperties documentProperties = new DocumentInstanceInputProperties();
    documentProperties.setWithWikiAttachmentsContent(bWithAttachmentContent);
    documentProperties.setWithJRCSRevisions(bWithVersions);
    documentProperties.setWithRevisions(false);
    // Output
    XAROutputProperties xarProperties = new XAROutputProperties();
    xarProperties.setPreserveVersion(bWithVersions);
    xarProperties.setEncoding(encoding);
    xarProperties.setFormat(format);
    try {
        Utils.getComponent(XWikiDocumentFilterUtils.class).exportEntity(this, out, xarProperties, documentProperties);
    } catch (Exception e) {
        throw new XWikiException(XWikiException.MODULE_XWIKI_DOC, XWikiException.ERROR_DOC_XML_PARSING, "Error parsing xml", e, null);
    }
}
Also used : DocumentInstanceInputProperties(org.xwiki.filter.instance.input.DocumentInstanceInputProperties) XWikiDocumentFilterUtils(com.xpn.xwiki.internal.filter.XWikiDocumentFilterUtils) XAROutputProperties(org.xwiki.filter.xar.output.XAROutputProperties) XWikiException(com.xpn.xwiki.XWikiException) ComponentLookupException(org.xwiki.component.manager.ComponentLookupException) IOException(java.io.IOException) XWikiException(com.xpn.xwiki.XWikiException)

Aggregations

DocumentInstanceInputProperties (org.xwiki.filter.instance.input.DocumentInstanceInputProperties)6 XAROutputProperties (org.xwiki.filter.xar.output.XAROutputProperties)5 XWikiException (com.xpn.xwiki.XWikiException)3 IOException (java.io.IOException)3 BeanOutputFilterStreamFactory (org.xwiki.filter.output.BeanOutputFilterStreamFactory)3 DocumentReference (org.xwiki.model.reference.DocumentReference)3 XWikiDocumentFilterUtils (com.xpn.xwiki.internal.filter.XWikiDocumentFilterUtils)2 Test (org.junit.Test)2 ComponentLookupException (org.xwiki.component.manager.ComponentLookupException)2 InputFilterStream (org.xwiki.filter.input.InputFilterStream)2 InputFilterStreamFactory (org.xwiki.filter.input.InputFilterStreamFactory)2 QueryException (org.xwiki.query.QueryException)2 XWikiContext (com.xpn.xwiki.XWikiContext)1 XWikiDocument (com.xpn.xwiki.doc.XWikiDocument)1 BaseObject (com.xpn.xwiki.objects.BaseObject)1 PackageAPI (com.xpn.xwiki.plugin.packaging.PackageAPI)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 List (java.util.List)1 ServletOutputStream (javax.servlet.ServletOutputStream)1 DifferentiationFailedException (org.suigeneris.jrcs.diff.DifferentiationFailedException)1