Search in sources :

Example 46 with XmlOptions

use of org.apache.xmlbeans.XmlOptions in project poi by apache.

the class XSSFDrawing method commit.

@Override
protected void commit() throws IOException {
    XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
    /*
            Saved drawings must have the following namespaces set:
            <xdr:wsDr
                xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
                xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing">
        */
    xmlOptions.setSaveSyntheticDocumentElement(new QName(CTDrawing.type.getName().getNamespaceURI(), "wsDr", "xdr"));
    PackagePart part = getPackagePart();
    OutputStream out = part.getOutputStream();
    drawing.save(out, xmlOptions);
    out.close();
}
Also used : QName(javax.xml.namespace.QName) XmlOptions(org.apache.xmlbeans.XmlOptions) OutputStream(java.io.OutputStream) PackagePart(org.apache.poi.openxml4j.opc.PackagePart)

Example 47 with XmlOptions

use of org.apache.xmlbeans.XmlOptions in project poi by apache.

the class XSSFPivotCacheDefinition method readFrom.

@Beta
public void readFrom(InputStream is) throws IOException {
    try {
        XmlOptions options = new XmlOptions(DEFAULT_XML_OPTIONS);
        //Removing root element
        options.setLoadReplaceDocumentElement(null);
        ctPivotCacheDefinition = CTPivotCacheDefinition.Factory.parse(is, options);
    } catch (XmlException e) {
        throw new IOException(e.getLocalizedMessage(), e);
    }
}
Also used : XmlException(org.apache.xmlbeans.XmlException) XmlOptions(org.apache.xmlbeans.XmlOptions) IOException(java.io.IOException) Beta(org.apache.poi.util.Beta)

Example 48 with XmlOptions

use of org.apache.xmlbeans.XmlOptions in project poi by apache.

the class XSSFPivotCacheRecords method readFrom.

@Beta
protected void readFrom(InputStream is) throws IOException {
    try {
        XmlOptions options = new XmlOptions(DEFAULT_XML_OPTIONS);
        //Removing root element
        options.setLoadReplaceDocumentElement(null);
        ctPivotCacheRecords = CTPivotCacheRecords.Factory.parse(is, options);
    } catch (XmlException e) {
        throw new IOException(e.getLocalizedMessage());
    }
}
Also used : XmlException(org.apache.xmlbeans.XmlException) XmlOptions(org.apache.xmlbeans.XmlOptions) IOException(java.io.IOException) Beta(org.apache.poi.util.Beta)

Example 49 with XmlOptions

use of org.apache.xmlbeans.XmlOptions in project poi by apache.

the class XSSFPivotCacheRecords method commit.

@Beta
@Override
protected void commit() throws IOException {
    PackagePart part = getPackagePart();
    OutputStream out = part.getOutputStream();
    XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
    //Sets the pivotCacheDefinition tag
    xmlOptions.setSaveSyntheticDocumentElement(new QName(CTPivotCacheRecords.type.getName().getNamespaceURI(), "pivotCacheRecords"));
    ctPivotCacheRecords.save(out, xmlOptions);
    out.close();
}
Also used : QName(javax.xml.namespace.QName) OutputStream(java.io.OutputStream) XmlOptions(org.apache.xmlbeans.XmlOptions) PackagePart(org.apache.poi.openxml4j.opc.PackagePart) Beta(org.apache.poi.util.Beta)

Example 50 with XmlOptions

use of org.apache.xmlbeans.XmlOptions in project poi by apache.

the class XSSFPivotTable method readFrom.

@Beta
public void readFrom(InputStream is) throws IOException {
    try {
        XmlOptions options = new XmlOptions(DEFAULT_XML_OPTIONS);
        //Removing root element
        options.setLoadReplaceDocumentElement(null);
        pivotTableDefinition = CTPivotTableDefinition.Factory.parse(is, options);
    } catch (XmlException e) {
        throw new IOException(e.getLocalizedMessage());
    }
}
Also used : XmlException(org.apache.xmlbeans.XmlException) XmlOptions(org.apache.xmlbeans.XmlOptions) IOException(java.io.IOException) Beta(org.apache.poi.util.Beta)

Aggregations

XmlOptions (org.apache.xmlbeans.XmlOptions)63 QName (javax.xml.namespace.QName)20 OutputStream (java.io.OutputStream)18 PackagePart (org.apache.poi.openxml4j.opc.PackagePart)17 ArrayList (java.util.ArrayList)12 XmlError (org.apache.xmlbeans.XmlError)11 XmlException (org.apache.xmlbeans.XmlException)11 IOException (java.io.IOException)9 Beta (org.apache.poi.util.Beta)7 Before (org.junit.Before)6 ByteArrayOutputStream (java.io.ByteArrayOutputStream)5 XmlObject (org.apache.xmlbeans.XmlObject)4 PackageDocument (com.centurylink.mdw.bpm.PackageDocument)3 PackageVO (com.centurylink.mdw.model.value.process.PackageVO)3 TaskVO (com.centurylink.mdw.model.value.task.TaskVO)3 EncodingException (org.n52.svalbard.encode.exception.EncodingException)3 MDWProcessDefinition (com.centurylink.mdw.bpm.MDWProcessDefinition)2 ProcessDefinitionDocument (com.centurylink.mdw.bpm.ProcessDefinitionDocument)2 AttributeVO (com.centurylink.mdw.model.value.attribute.AttributeVO)2 Attribute (com.centurylink.mdw.task.Attribute)2