Search in sources :

Example 1 with DOMXMLWriter

use of com.xpn.xwiki.internal.xml.DOMXMLWriter in project xwiki-platform by xwiki.

the class XWikiDocument method toXMLDocument.

/**
 * Serialize the document to an XML {@link DOMDocument}. You should prefer
 * {@link #toXML(OutputStream, boolean, boolean, boolean, boolean, XWikiContext)} or
 * {@link #toXML(com.xpn.xwiki.internal.xml.XMLWriter, boolean, boolean, boolean, boolean, XWikiContext)} when
 * possible to reduce memory load.
 *
 * @param bWithObjects include XObjects
 * @param bWithRendering include the rendered content
 * @param bWithAttachmentContent include attachments content
 * @param bWithVersions include archived versions
 * @param context current XWikiContext
 * @return a {@link DOMDocument} containing the serialized document.
 * @throws XWikiException when an errors occurs during wiki operations
 * @deprecated since 9.0RC1, use {@link #toXML(OutputTarget, boolean, boolean, boolean, boolean, boolean, String)}
 *             instead
 */
@Deprecated
public Document toXMLDocument(boolean bWithObjects, boolean bWithRendering, boolean bWithAttachmentContent, boolean bWithVersions, XWikiContext context) throws XWikiException {
    Document doc = new DOMDocument();
    DOMXMLWriter wr = new DOMXMLWriter(doc, new OutputFormat("", true, context.getWiki().getEncoding()));
    try {
        toXML(wr, bWithObjects, bWithRendering, bWithAttachmentContent, bWithVersions, context);
        return doc;
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
Also used : DOMDocument(org.dom4j.dom.DOMDocument) OutputFormat(org.dom4j.io.OutputFormat) DOMXMLWriter(com.xpn.xwiki.internal.xml.DOMXMLWriter) IOException(java.io.IOException) Document(org.dom4j.Document) DOMDocument(org.dom4j.dom.DOMDocument)

Aggregations

DOMXMLWriter (com.xpn.xwiki.internal.xml.DOMXMLWriter)1 IOException (java.io.IOException)1 Document (org.dom4j.Document)1 DOMDocument (org.dom4j.dom.DOMDocument)1 OutputFormat (org.dom4j.io.OutputFormat)1