Use the default XmlOptions for all the invocations of the XmlBeans XML parsing
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1709128 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
14dda10c59
commit
43ab1cd35a
@ -61,6 +61,7 @@ public class POIXMLDocumentPart {
|
|||||||
DEFAULT_XML_OPTIONS.setUseDefaultNamespace();
|
DEFAULT_XML_OPTIONS.setUseDefaultNamespace();
|
||||||
DEFAULT_XML_OPTIONS.setSaveAggressiveNamespaces();
|
DEFAULT_XML_OPTIONS.setSaveAggressiveNamespaces();
|
||||||
DEFAULT_XML_OPTIONS.setCharacterEncoding("UTF-8");
|
DEFAULT_XML_OPTIONS.setCharacterEncoding("UTF-8");
|
||||||
|
DEFAULT_XML_OPTIONS.setLoadEntityBytesLimit(4096);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String coreDocumentRel = PackageRelationshipTypes.CORE_DOCUMENT;
|
private String coreDocumentRel = PackageRelationshipTypes.CORE_DOCUMENT;
|
||||||
|
@ -33,6 +33,7 @@ import org.apache.poi.openxml4j.opc.PackagingURIHelper;
|
|||||||
import org.apache.poi.openxml4j.opc.TargetMode;
|
import org.apache.poi.openxml4j.opc.TargetMode;
|
||||||
import org.apache.poi.openxml4j.opc.internal.PackagePropertiesPart;
|
import org.apache.poi.openxml4j.opc.internal.PackagePropertiesPart;
|
||||||
import org.apache.poi.openxml4j.util.Nullable;
|
import org.apache.poi.openxml4j.util.Nullable;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.xmlbeans.XmlException;
|
import org.apache.xmlbeans.XmlException;
|
||||||
import org.apache.xmlbeans.XmlOptions;
|
import org.apache.xmlbeans.XmlOptions;
|
||||||
import org.openxmlformats.schemas.officeDocument.x2006.customProperties.CTProperty;
|
import org.openxmlformats.schemas.officeDocument.x2006.customProperties.CTProperty;
|
||||||
@ -73,7 +74,7 @@ public class POIXMLProperties {
|
|||||||
if(extRel.size() == 1) {
|
if(extRel.size() == 1) {
|
||||||
extPart = pkg.getPart( extRel.getRelationship(0));
|
extPart = pkg.getPart( extRel.getRelationship(0));
|
||||||
org.openxmlformats.schemas.officeDocument.x2006.extendedProperties.PropertiesDocument props = org.openxmlformats.schemas.officeDocument.x2006.extendedProperties.PropertiesDocument.Factory.parse(
|
org.openxmlformats.schemas.officeDocument.x2006.extendedProperties.PropertiesDocument props = org.openxmlformats.schemas.officeDocument.x2006.extendedProperties.PropertiesDocument.Factory.parse(
|
||||||
extPart.getInputStream()
|
extPart.getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS
|
||||||
);
|
);
|
||||||
ext = new ExtendedProperties(props);
|
ext = new ExtendedProperties(props);
|
||||||
} else {
|
} else {
|
||||||
@ -87,7 +88,7 @@ public class POIXMLProperties {
|
|||||||
if(custRel.size() == 1) {
|
if(custRel.size() == 1) {
|
||||||
custPart = pkg.getPart( custRel.getRelationship(0));
|
custPart = pkg.getPart( custRel.getRelationship(0));
|
||||||
org.openxmlformats.schemas.officeDocument.x2006.customProperties.PropertiesDocument props = org.openxmlformats.schemas.officeDocument.x2006.customProperties.PropertiesDocument.Factory.parse(
|
org.openxmlformats.schemas.officeDocument.x2006.customProperties.PropertiesDocument props = org.openxmlformats.schemas.officeDocument.x2006.customProperties.PropertiesDocument.Factory.parse(
|
||||||
custPart.getInputStream()
|
custPart.getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS
|
||||||
);
|
);
|
||||||
cust = new CustomProperties(props);
|
cust = new CustomProperties(props);
|
||||||
} else {
|
} else {
|
||||||
|
@ -20,6 +20,7 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
import org.apache.poi.EncryptedDocumentException;
|
import org.apache.poi.EncryptedDocumentException;
|
||||||
|
import org.apache.poi.POIXMLDocumentPart;
|
||||||
import org.apache.poi.poifs.crypt.ChainingMode;
|
import org.apache.poi.poifs.crypt.ChainingMode;
|
||||||
import org.apache.poi.poifs.crypt.CipherAlgorithm;
|
import org.apache.poi.poifs.crypt.CipherAlgorithm;
|
||||||
import org.apache.poi.poifs.crypt.EncryptionInfo;
|
import org.apache.poi.poifs.crypt.EncryptionInfo;
|
||||||
@ -111,7 +112,7 @@ public class AgileEncryptionInfoBuilder implements EncryptionInfoBuilder {
|
|||||||
|
|
||||||
protected static EncryptionDocument parseDescriptor(String descriptor) {
|
protected static EncryptionDocument parseDescriptor(String descriptor) {
|
||||||
try {
|
try {
|
||||||
return EncryptionDocument.Factory.parse(descriptor);
|
return EncryptionDocument.Factory.parse(descriptor, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
} catch (XmlException e) {
|
} catch (XmlException e) {
|
||||||
throw new EncryptedDocumentException("Unable to parse encryption descriptor", e);
|
throw new EncryptedDocumentException("Unable to parse encryption descriptor", e);
|
||||||
}
|
}
|
||||||
@ -119,7 +120,7 @@ public class AgileEncryptionInfoBuilder implements EncryptionInfoBuilder {
|
|||||||
|
|
||||||
protected static EncryptionDocument parseDescriptor(InputStream descriptor) {
|
protected static EncryptionDocument parseDescriptor(InputStream descriptor) {
|
||||||
try {
|
try {
|
||||||
return EncryptionDocument.Factory.parse(descriptor);
|
return EncryptionDocument.Factory.parse(descriptor, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new EncryptedDocumentException("Unable to parse encryption descriptor", e);
|
throw new EncryptedDocumentException("Unable to parse encryption descriptor", e);
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,7 @@ import javax.xml.xpath.XPathFactory;
|
|||||||
import org.apache.jcp.xml.dsig.internal.dom.DOMReference;
|
import org.apache.jcp.xml.dsig.internal.dom.DOMReference;
|
||||||
import org.apache.jcp.xml.dsig.internal.dom.DOMSignedInfo;
|
import org.apache.jcp.xml.dsig.internal.dom.DOMSignedInfo;
|
||||||
import org.apache.poi.EncryptedDocumentException;
|
import org.apache.poi.EncryptedDocumentException;
|
||||||
|
import org.apache.poi.POIXMLDocumentPart;
|
||||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||||
import org.apache.poi.openxml4j.opc.ContentTypes;
|
import org.apache.poi.openxml4j.opc.ContentTypes;
|
||||||
import org.apache.poi.openxml4j.opc.OPCPackage;
|
import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||||
@ -212,7 +213,7 @@ public class SignatureInfo implements SignatureConfigurable {
|
|||||||
*/
|
*/
|
||||||
public SignatureDocument getSignatureDocument() throws IOException, XmlException {
|
public SignatureDocument getSignatureDocument() throws IOException, XmlException {
|
||||||
// TODO: check for XXE
|
// TODO: check for XXE
|
||||||
return SignatureDocument.Factory.parse(signaturePart.getInputStream());
|
return SignatureDocument.Factory.parse(signaturePart.getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -630,7 +631,7 @@ public class SignatureInfo implements SignatureConfigurable {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
OutputStream os = sigPart.getOutputStream();
|
OutputStream os = sigPart.getOutputStream();
|
||||||
SignatureDocument sigDoc = SignatureDocument.Factory.parse(document);
|
SignatureDocument sigDoc = SignatureDocument.Factory.parse(document, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
sigDoc.save(os, xo);
|
sigDoc.save(os, xo);
|
||||||
os.close();
|
os.close();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -26,6 +26,7 @@ package org.apache.poi.poifs.crypt.dsig.facets;
|
|||||||
|
|
||||||
import javax.xml.crypto.MarshalException;
|
import javax.xml.crypto.MarshalException;
|
||||||
|
|
||||||
|
import org.apache.poi.POIXMLDocumentPart;
|
||||||
import org.apache.xmlbeans.XmlException;
|
import org.apache.xmlbeans.XmlException;
|
||||||
import org.etsi.uri.x01903.v13.QualifyingPropertiesType;
|
import org.etsi.uri.x01903.v13.QualifyingPropertiesType;
|
||||||
import org.etsi.uri.x01903.v13.UnsignedPropertiesType;
|
import org.etsi.uri.x01903.v13.UnsignedPropertiesType;
|
||||||
@ -56,7 +57,7 @@ public class Office2010SignatureFacet extends SignatureFacet {
|
|||||||
|
|
||||||
QualifyingPropertiesType qualProps;
|
QualifyingPropertiesType qualProps;
|
||||||
try {
|
try {
|
||||||
qualProps = QualifyingPropertiesType.Factory.parse(nl.item(0));
|
qualProps = QualifyingPropertiesType.Factory.parse(nl.item(0), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
} catch (XmlException e) {
|
} catch (XmlException e) {
|
||||||
throw new MarshalException(e);
|
throw new MarshalException(e);
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,7 @@ import java.util.UUID;
|
|||||||
|
|
||||||
import javax.xml.crypto.MarshalException;
|
import javax.xml.crypto.MarshalException;
|
||||||
|
|
||||||
|
import org.apache.poi.POIXMLDocumentPart;
|
||||||
import org.apache.poi.poifs.crypt.dsig.services.RevocationData;
|
import org.apache.poi.poifs.crypt.dsig.services.RevocationData;
|
||||||
import org.apache.poi.util.POILogFactory;
|
import org.apache.poi.util.POILogFactory;
|
||||||
import org.apache.poi.util.POILogger;
|
import org.apache.poi.util.POILogger;
|
||||||
@ -128,7 +129,7 @@ public class XAdESXLSignatureFacet extends SignatureFacet {
|
|||||||
NodeList qualNl = document.getElementsByTagNameNS(XADES_132_NS, "QualifyingProperties");
|
NodeList qualNl = document.getElementsByTagNameNS(XADES_132_NS, "QualifyingProperties");
|
||||||
if (qualNl.getLength() == 1) {
|
if (qualNl.getLength() == 1) {
|
||||||
try {
|
try {
|
||||||
qualDoc = QualifyingPropertiesDocument.Factory.parse(qualNl.item(0));
|
qualDoc = QualifyingPropertiesDocument.Factory.parse(qualNl.item(0), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
} catch (XmlException e) {
|
} catch (XmlException e) {
|
||||||
throw new MarshalException(e);
|
throw new MarshalException(e);
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,7 @@ import javax.xml.crypto.dsig.TransformException;
|
|||||||
import javax.xml.crypto.dsig.TransformService;
|
import javax.xml.crypto.dsig.TransformService;
|
||||||
import javax.xml.crypto.dsig.spec.TransformParameterSpec;
|
import javax.xml.crypto.dsig.spec.TransformParameterSpec;
|
||||||
|
|
||||||
|
import org.apache.poi.POIXMLDocumentPart;
|
||||||
import org.apache.poi.util.POILogFactory;
|
import org.apache.poi.util.POILogFactory;
|
||||||
import org.apache.poi.util.POILogger;
|
import org.apache.poi.util.POILogger;
|
||||||
import org.apache.poi.util.XmlSort;
|
import org.apache.poi.util.XmlSort;
|
||||||
@ -141,7 +142,7 @@ public class RelationshipTransformService extends TransformService {
|
|||||||
Node parentNode = domParent.getNode();
|
Node parentNode = domParent.getNode();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
TransformDocument transDoc = TransformDocument.Factory.parse(parentNode);
|
TransformDocument transDoc = TransformDocument.Factory.parse(parentNode, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
XmlObject xoList[] = transDoc.getTransform().selectChildren(RelationshipReferenceDocument.type.getDocumentElementName());
|
XmlObject xoList[] = transDoc.getTransform().selectChildren(RelationshipReferenceDocument.type.getDocumentElementName());
|
||||||
if (xoList.length == 0) {
|
if (xoList.length == 0) {
|
||||||
LOG.log(POILogger.WARN, "no RelationshipReference/@SourceId parameters present");
|
LOG.log(POILogger.WARN, "no RelationshipReference/@SourceId parameters present");
|
||||||
@ -187,7 +188,7 @@ public class RelationshipTransformService extends TransformService {
|
|||||||
|
|
||||||
RelationshipsDocument relDoc;
|
RelationshipsDocument relDoc;
|
||||||
try {
|
try {
|
||||||
relDoc = RelationshipsDocument.Factory.parse(octetStream);
|
relDoc = RelationshipsDocument.Factory.parse(octetStream, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new TransformException(e.getMessage(), e);
|
throw new TransformException(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ import java.util.Comparator;
|
|||||||
|
|
||||||
import javax.xml.namespace.QName;
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
|
import org.apache.poi.POIXMLDocumentPart;
|
||||||
import org.apache.xmlbeans.XmlCursor;
|
import org.apache.xmlbeans.XmlCursor;
|
||||||
import org.apache.xmlbeans.XmlException;
|
import org.apache.xmlbeans.XmlException;
|
||||||
import org.apache.xmlbeans.XmlObject;
|
import org.apache.xmlbeans.XmlObject;
|
||||||
@ -49,7 +50,7 @@ public final class XmlSort
|
|||||||
File f = new File(args[0]);
|
File f = new File(args[0]);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
XmlObject docInstance = XmlObject.Factory.parse(f);
|
XmlObject docInstance = XmlObject.Factory.parse(f, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
XmlObject element = null;
|
XmlObject element = null;
|
||||||
if (args.length > 1)
|
if (args.length > 1)
|
||||||
{
|
{
|
||||||
|
@ -41,6 +41,7 @@ import org.apache.poi.sl.usermodel.PictureData.PictureType;
|
|||||||
import org.apache.poi.sl.usermodel.Resources;
|
import org.apache.poi.sl.usermodel.Resources;
|
||||||
import org.apache.poi.sl.usermodel.SlideShow;
|
import org.apache.poi.sl.usermodel.SlideShow;
|
||||||
import org.apache.poi.util.Beta;
|
import org.apache.poi.util.Beta;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.poi.util.IOUtils;
|
import org.apache.poi.util.IOUtils;
|
||||||
import org.apache.poi.util.Internal;
|
import org.apache.poi.util.Internal;
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
@ -127,7 +128,7 @@ implements SlideShow<XSLFShape,XSLFTextParagraph> {
|
|||||||
protected void onDocumentRead() throws IOException {
|
protected void onDocumentRead() throws IOException {
|
||||||
try {
|
try {
|
||||||
PresentationDocument doc =
|
PresentationDocument doc =
|
||||||
PresentationDocument.Factory.parse(getCorePart().getInputStream());
|
PresentationDocument.Factory.parse(getCorePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
_presentation = doc.getPresentation();
|
_presentation = doc.getPresentation();
|
||||||
|
|
||||||
Map<String, XSLFSlideMaster> masterMap = new HashMap<String, XSLFSlideMaster>();
|
Map<String, XSLFSlideMaster> masterMap = new HashMap<String, XSLFSlideMaster>();
|
||||||
|
@ -23,6 +23,7 @@ import org.apache.poi.POIXMLDocumentPart;
|
|||||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||||
import org.apache.poi.util.Beta;
|
import org.apache.poi.util.Beta;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.poi.util.Internal;
|
import org.apache.poi.util.Internal;
|
||||||
import org.apache.xmlbeans.XmlException;
|
import org.apache.xmlbeans.XmlException;
|
||||||
import org.apache.xmlbeans.XmlOptions;
|
import org.apache.xmlbeans.XmlOptions;
|
||||||
@ -65,7 +66,7 @@ public final class XSLFChart extends POIXMLDocumentPart {
|
|||||||
protected XSLFChart(PackagePart part, PackageRelationship rel) throws IOException, XmlException {
|
protected XSLFChart(PackagePart part, PackageRelationship rel) throws IOException, XmlException {
|
||||||
super(part, rel);
|
super(part, rel);
|
||||||
|
|
||||||
chartSpace = ChartSpaceDocument.Factory.parse(part.getInputStream()).getChartSpace();
|
chartSpace = ChartSpaceDocument.Factory.parse(part.getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS).getChartSpace();
|
||||||
chart = chartSpace.getChart();
|
chart = chartSpace.getChart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ import org.apache.poi.POIXMLDocumentPart;
|
|||||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||||
import org.apache.poi.util.Beta;
|
import org.apache.poi.util.Beta;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.xmlbeans.XmlException;
|
import org.apache.xmlbeans.XmlException;
|
||||||
import org.openxmlformats.schemas.presentationml.x2006.main.CTCommentAuthor;
|
import org.openxmlformats.schemas.presentationml.x2006.main.CTCommentAuthor;
|
||||||
import org.openxmlformats.schemas.presentationml.x2006.main.CTCommentAuthorList;
|
import org.openxmlformats.schemas.presentationml.x2006.main.CTCommentAuthorList;
|
||||||
@ -53,7 +54,7 @@ public class XSLFCommentAuthors extends POIXMLDocumentPart {
|
|||||||
super(part, rel);
|
super(part, rel);
|
||||||
|
|
||||||
CmAuthorLstDocument doc =
|
CmAuthorLstDocument doc =
|
||||||
CmAuthorLstDocument.Factory.parse(getPackagePart().getInputStream());
|
CmAuthorLstDocument.Factory.parse(getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
_authors = doc.getCmAuthorLst();
|
_authors = doc.getCmAuthorLst();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ import org.apache.poi.POIXMLDocumentPart;
|
|||||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||||
import org.apache.poi.util.Beta;
|
import org.apache.poi.util.Beta;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.xmlbeans.XmlException;
|
import org.apache.xmlbeans.XmlException;
|
||||||
import org.openxmlformats.schemas.presentationml.x2006.main.CTComment;
|
import org.openxmlformats.schemas.presentationml.x2006.main.CTComment;
|
||||||
import org.openxmlformats.schemas.presentationml.x2006.main.CTCommentList;
|
import org.openxmlformats.schemas.presentationml.x2006.main.CTCommentList;
|
||||||
@ -53,7 +54,7 @@ public class XSLFComments extends POIXMLDocumentPart {
|
|||||||
super(part, rel);
|
super(part, rel);
|
||||||
|
|
||||||
CmLstDocument doc =
|
CmLstDocument doc =
|
||||||
CmLstDocument.Factory.parse(getPackagePart().getInputStream());
|
CmLstDocument.Factory.parse(getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
_comments = doc.getCmLst();
|
_comments = doc.getCmLst();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.poi.POIXMLDocumentPart;
|
||||||
import org.apache.poi.POIXMLException;
|
import org.apache.poi.POIXMLException;
|
||||||
import org.apache.poi.util.Beta;
|
import org.apache.poi.util.Beta;
|
||||||
import org.apache.xmlbeans.XmlCursor;
|
import org.apache.xmlbeans.XmlCursor;
|
||||||
@ -67,7 +68,7 @@ public class XSLFCommonSlideData {
|
|||||||
if (o instanceof XmlAnyTypeImpl) {
|
if (o instanceof XmlAnyTypeImpl) {
|
||||||
// Pesky XmlBeans bug - see Bugzilla #49934
|
// Pesky XmlBeans bug - see Bugzilla #49934
|
||||||
try {
|
try {
|
||||||
o = CTTable.Factory.parse(o.toString());
|
o = CTTable.Factory.parse(o.toString(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
} catch (XmlException e) {
|
} catch (XmlException e) {
|
||||||
throw new POIXMLException(e);
|
throw new POIXMLException(e);
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ import org.apache.poi.openxml4j.opc.PackagePart;
|
|||||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||||
import org.apache.poi.sl.usermodel.Notes;
|
import org.apache.poi.sl.usermodel.Notes;
|
||||||
import org.apache.poi.util.Beta;
|
import org.apache.poi.util.Beta;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.xmlbeans.XmlException;
|
import org.apache.xmlbeans.XmlException;
|
||||||
import org.openxmlformats.schemas.presentationml.x2006.main.CTCommonSlideData;
|
import org.openxmlformats.schemas.presentationml.x2006.main.CTCommonSlideData;
|
||||||
import org.openxmlformats.schemas.presentationml.x2006.main.CTNotesSlide;
|
import org.openxmlformats.schemas.presentationml.x2006.main.CTNotesSlide;
|
||||||
@ -56,7 +57,7 @@ implements Notes<XSLFShape,XSLFTextParagraph> {
|
|||||||
super(part, rel);
|
super(part, rel);
|
||||||
|
|
||||||
NotesDocument doc =
|
NotesDocument doc =
|
||||||
NotesDocument.Factory.parse(getPackagePart().getInputStream());
|
NotesDocument.Factory.parse(getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
_notes = doc.getNotes();
|
_notes = doc.getNotes();
|
||||||
setCommonSlideData(_notes.getCSld());
|
setCommonSlideData(_notes.getCSld());
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ import org.apache.poi.openxml4j.opc.PackagePart;
|
|||||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||||
import org.apache.poi.sl.usermodel.MasterSheet;
|
import org.apache.poi.sl.usermodel.MasterSheet;
|
||||||
import org.apache.poi.util.Beta;
|
import org.apache.poi.util.Beta;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.xmlbeans.XmlException;
|
import org.apache.xmlbeans.XmlException;
|
||||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTColorMapping;
|
import org.openxmlformats.schemas.drawingml.x2006.main.CTColorMapping;
|
||||||
import org.openxmlformats.schemas.presentationml.x2006.main.CTNotesMaster;
|
import org.openxmlformats.schemas.presentationml.x2006.main.CTNotesMaster;
|
||||||
@ -60,7 +61,7 @@ import org.openxmlformats.schemas.presentationml.x2006.main.NotesMasterDocument;
|
|||||||
protected XSLFNotesMaster(PackagePart part, PackageRelationship rel) throws IOException, XmlException {
|
protected XSLFNotesMaster(PackagePart part, PackageRelationship rel) throws IOException, XmlException {
|
||||||
super(part, rel);
|
super(part, rel);
|
||||||
NotesMasterDocument doc =
|
NotesMasterDocument doc =
|
||||||
NotesMasterDocument.Factory.parse(getPackagePart().getInputStream());
|
NotesMasterDocument.Factory.parse(getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
_slide = doc.getNotesMaster();
|
_slide = doc.getNotesMaster();
|
||||||
setCommonSlideData(_slide.getCSld());
|
setCommonSlideData(_slide.getCSld());
|
||||||
}
|
}
|
||||||
@ -73,7 +74,7 @@ import org.openxmlformats.schemas.presentationml.x2006.main.NotesMasterDocument;
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
NotesMasterDocument doc = NotesMasterDocument.Factory.parse(is);
|
NotesMasterDocument doc = NotesMasterDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
CTNotesMaster slide = doc.getNotesMaster();
|
CTNotesMaster slide = doc.getNotesMaster();
|
||||||
return slide;
|
return slide;
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -27,6 +27,7 @@ import org.apache.poi.sl.draw.Drawable;
|
|||||||
import org.apache.poi.sl.usermodel.Notes;
|
import org.apache.poi.sl.usermodel.Notes;
|
||||||
import org.apache.poi.sl.usermodel.Slide;
|
import org.apache.poi.sl.usermodel.Slide;
|
||||||
import org.apache.poi.util.Beta;
|
import org.apache.poi.util.Beta;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.xmlbeans.XmlException;
|
import org.apache.xmlbeans.XmlException;
|
||||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTBlip;
|
import org.openxmlformats.schemas.drawingml.x2006.main.CTBlip;
|
||||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTGroupShapeProperties;
|
import org.openxmlformats.schemas.drawingml.x2006.main.CTGroupShapeProperties;
|
||||||
@ -70,7 +71,7 @@ implements Slide<XSLFShape,XSLFTextParagraph> {
|
|||||||
super(part, rel);
|
super(part, rel);
|
||||||
|
|
||||||
SldDocument doc =
|
SldDocument doc =
|
||||||
SldDocument.Factory.parse(getPackagePart().getInputStream());
|
SldDocument.Factory.parse(getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
_slide = doc.getSld();
|
_slide = doc.getSld();
|
||||||
setCommonSlideData(_slide.getCSld());
|
setCommonSlideData(_slide.getCSld());
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ import org.apache.poi.openxml4j.opc.PackagePart;
|
|||||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||||
import org.apache.poi.sl.usermodel.MasterSheet;
|
import org.apache.poi.sl.usermodel.MasterSheet;
|
||||||
import org.apache.poi.util.Beta;
|
import org.apache.poi.util.Beta;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.poi.util.Internal;
|
import org.apache.poi.util.Internal;
|
||||||
import org.apache.xmlbeans.XmlException;
|
import org.apache.xmlbeans.XmlException;
|
||||||
import org.openxmlformats.schemas.presentationml.x2006.main.CTBackground;
|
import org.openxmlformats.schemas.presentationml.x2006.main.CTBackground;
|
||||||
@ -44,7 +45,7 @@ implements MasterSheet<XSLFShape,XSLFTextParagraph> {
|
|||||||
public XSLFSlideLayout(PackagePart part, PackageRelationship rel) throws IOException, XmlException {
|
public XSLFSlideLayout(PackagePart part, PackageRelationship rel) throws IOException, XmlException {
|
||||||
super(part, rel);
|
super(part, rel);
|
||||||
SldLayoutDocument doc =
|
SldLayoutDocument doc =
|
||||||
SldLayoutDocument.Factory.parse(getPackagePart().getInputStream());
|
SldLayoutDocument.Factory.parse(getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
_layout = doc.getSldLayout();
|
_layout = doc.getSldLayout();
|
||||||
setCommonSlideData(_layout.getCSld());
|
setCommonSlideData(_layout.getCSld());
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ import org.apache.poi.openxml4j.opc.PackagePart;
|
|||||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||||
import org.apache.poi.sl.usermodel.MasterSheet;
|
import org.apache.poi.sl.usermodel.MasterSheet;
|
||||||
import org.apache.poi.util.Beta;
|
import org.apache.poi.util.Beta;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.xmlbeans.XmlException;
|
import org.apache.xmlbeans.XmlException;
|
||||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTColorMapping;
|
import org.openxmlformats.schemas.drawingml.x2006.main.CTColorMapping;
|
||||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextListStyle;
|
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextListStyle;
|
||||||
@ -69,7 +70,7 @@ import org.openxmlformats.schemas.presentationml.x2006.main.SldMasterDocument;
|
|||||||
protected XSLFSlideMaster(PackagePart part, PackageRelationship rel) throws IOException, XmlException {
|
protected XSLFSlideMaster(PackagePart part, PackageRelationship rel) throws IOException, XmlException {
|
||||||
super(part, rel);
|
super(part, rel);
|
||||||
SldMasterDocument doc =
|
SldMasterDocument doc =
|
||||||
SldMasterDocument.Factory.parse(getPackagePart().getInputStream());
|
SldMasterDocument.Factory.parse(getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
_slide = doc.getSldMaster();
|
_slide = doc.getSldMaster();
|
||||||
setCommonSlideData(_slide.getCSld());
|
setCommonSlideData(_slide.getCSld());
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.poi.POIXMLDocument;
|
import org.apache.poi.POIXMLDocument;
|
||||||
|
import org.apache.poi.POIXMLDocumentPart;
|
||||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||||
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
|
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
|
||||||
import org.apache.poi.openxml4j.opc.OPCPackage;
|
import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||||
@ -73,7 +74,7 @@ public class XSLFSlideShow extends POIXMLDocument {
|
|||||||
}
|
}
|
||||||
|
|
||||||
presentationDoc =
|
presentationDoc =
|
||||||
PresentationDocument.Factory.parse(getCorePart().getInputStream());
|
PresentationDocument.Factory.parse(getCorePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
|
|
||||||
embedds = new LinkedList<PackagePart>();
|
embedds = new LinkedList<PackagePart>();
|
||||||
for (CTSlideIdListEntry ctSlide : getSlideReferences().getSldIdArray()) {
|
for (CTSlideIdListEntry ctSlide : getSlideReferences().getSldIdArray()) {
|
||||||
@ -145,7 +146,7 @@ public class XSLFSlideShow extends POIXMLDocument {
|
|||||||
public CTSlideMaster getSlideMaster(CTSlideMasterIdListEntry master) throws IOException, XmlException {
|
public CTSlideMaster getSlideMaster(CTSlideMasterIdListEntry master) throws IOException, XmlException {
|
||||||
PackagePart masterPart = getSlideMasterPart(master);
|
PackagePart masterPart = getSlideMasterPart(master);
|
||||||
SldMasterDocument masterDoc =
|
SldMasterDocument masterDoc =
|
||||||
SldMasterDocument.Factory.parse(masterPart.getInputStream());
|
SldMasterDocument.Factory.parse(masterPart.getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
return masterDoc.getSldMaster();
|
return masterDoc.getSldMaster();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,7 +166,7 @@ public class XSLFSlideShow extends POIXMLDocument {
|
|||||||
public CTSlide getSlide(CTSlideIdListEntry slide) throws IOException, XmlException {
|
public CTSlide getSlide(CTSlideIdListEntry slide) throws IOException, XmlException {
|
||||||
PackagePart slidePart = getSlidePart(slide);
|
PackagePart slidePart = getSlidePart(slide);
|
||||||
SldDocument slideDoc =
|
SldDocument slideDoc =
|
||||||
SldDocument.Factory.parse(slidePart.getInputStream());
|
SldDocument.Factory.parse(slidePart.getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
return slideDoc.getSld();
|
return slideDoc.getSld();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,7 +209,7 @@ public class XSLFSlideShow extends POIXMLDocument {
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
NotesDocument notesDoc =
|
NotesDocument notesDoc =
|
||||||
NotesDocument.Factory.parse(notesPart.getInputStream());
|
NotesDocument.Factory.parse(notesPart.getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
|
|
||||||
return notesDoc.getNotes();
|
return notesDoc.getNotes();
|
||||||
}
|
}
|
||||||
@ -240,7 +241,7 @@ public class XSLFSlideShow extends POIXMLDocument {
|
|||||||
commentRels.getRelationship(0)
|
commentRels.getRelationship(0)
|
||||||
);
|
);
|
||||||
CmLstDocument commDoc =
|
CmLstDocument commDoc =
|
||||||
CmLstDocument.Factory.parse(cPart.getInputStream());
|
CmLstDocument.Factory.parse(cPart.getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
return commDoc.getCmLst();
|
return commDoc.getCmLst();
|
||||||
} catch(InvalidFormatException e) {
|
} catch(InvalidFormatException e) {
|
||||||
throw new IllegalStateException(e);
|
throw new IllegalStateException(e);
|
||||||
|
@ -26,6 +26,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.xml.namespace.QName;
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
|
import org.apache.poi.POIXMLDocumentPart;
|
||||||
import org.apache.poi.POIXMLException;
|
import org.apache.poi.POIXMLException;
|
||||||
import org.apache.poi.sl.usermodel.TableShape;
|
import org.apache.poi.sl.usermodel.TableShape;
|
||||||
import org.apache.poi.util.Internal;
|
import org.apache.poi.util.Internal;
|
||||||
@ -67,7 +68,7 @@ public class XSLFTable extends XSLFGraphicFrame implements Iterable<XSLFTableRow
|
|||||||
// it never happens when using the full ooxml-schemas jar but may happen with the abridged poi-ooxml-schemas
|
// it never happens when using the full ooxml-schemas jar but may happen with the abridged poi-ooxml-schemas
|
||||||
if(rs[0] instanceof XmlAnyTypeImpl){
|
if(rs[0] instanceof XmlAnyTypeImpl){
|
||||||
try {
|
try {
|
||||||
rs[0] = CTTable.Factory.parse(rs[0].toString());
|
rs[0] = CTTable.Factory.parse(rs[0].toString(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
}catch (XmlException e){
|
}catch (XmlException e){
|
||||||
throw new POIXMLException(e);
|
throw new POIXMLException(e);
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ import org.apache.poi.POIXMLDocumentPart;
|
|||||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||||
import org.apache.poi.util.Beta;
|
import org.apache.poi.util.Beta;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.xmlbeans.XmlException;
|
import org.apache.xmlbeans.XmlException;
|
||||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTTableStyle;
|
import org.openxmlformats.schemas.drawingml.x2006.main.CTTableStyle;
|
||||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTTableStyleList;
|
import org.openxmlformats.schemas.drawingml.x2006.main.CTTableStyleList;
|
||||||
@ -43,7 +44,7 @@ public class XSLFTableStyles extends POIXMLDocumentPart implements Iterable<XSLF
|
|||||||
public XSLFTableStyles(PackagePart part, PackageRelationship rel) throws IOException, XmlException {
|
public XSLFTableStyles(PackagePart part, PackageRelationship rel) throws IOException, XmlException {
|
||||||
super(part, rel);
|
super(part, rel);
|
||||||
|
|
||||||
_tblStyleLst = CTTableStyleList.Factory.parse(getPackagePart().getInputStream());
|
_tblStyleLst = CTTableStyleList.Factory.parse(getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
CTTableStyle[] tblStyleArray = _tblStyleLst.getTblStyleArray();
|
CTTableStyle[] tblStyleArray = _tblStyleLst.getTblStyleArray();
|
||||||
_styles = new ArrayList<XSLFTableStyle>(tblStyleArray.length);
|
_styles = new ArrayList<XSLFTableStyle>(tblStyleArray.length);
|
||||||
for(CTTableStyle c : tblStyleArray){
|
for(CTTableStyle c : tblStyleArray){
|
||||||
|
@ -27,6 +27,7 @@ import org.apache.poi.POIXMLDocumentPart;
|
|||||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||||
import org.apache.poi.util.Beta;
|
import org.apache.poi.util.Beta;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.poi.util.Internal;
|
import org.apache.poi.util.Internal;
|
||||||
import org.apache.xmlbeans.XmlException;
|
import org.apache.xmlbeans.XmlException;
|
||||||
import org.apache.xmlbeans.XmlObject;
|
import org.apache.xmlbeans.XmlObject;
|
||||||
@ -57,7 +58,7 @@ public class XSLFTheme extends POIXMLDocumentPart {
|
|||||||
public XSLFTheme(PackagePart part, PackageRelationship rel) throws IOException, XmlException {
|
public XSLFTheme(PackagePart part, PackageRelationship rel) throws IOException, XmlException {
|
||||||
super(part, rel);
|
super(part, rel);
|
||||||
ThemeDocument doc =
|
ThemeDocument doc =
|
||||||
ThemeDocument.Factory.parse(getPackagePart().getInputStream());
|
ThemeDocument.Factory.parse(getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
_theme = doc.getTheme();
|
_theme = doc.getTheme();
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ import java.util.Enumeration;
|
|||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipFile;
|
import java.util.zip.ZipFile;
|
||||||
|
|
||||||
|
import org.apache.poi.POIXMLDocumentPart;
|
||||||
import org.apache.poi.openxml4j.opc.internal.ZipHelper;
|
import org.apache.poi.openxml4j.opc.internal.ZipHelper;
|
||||||
import org.apache.poi.util.IOUtils;
|
import org.apache.poi.util.IOUtils;
|
||||||
import org.apache.xmlbeans.XmlObject;
|
import org.apache.xmlbeans.XmlObject;
|
||||||
@ -70,7 +71,7 @@ public final class XSSFDump {
|
|||||||
try {
|
try {
|
||||||
if(entry.getName().endsWith(".xml") || entry.getName().endsWith(".vml") || entry.getName().endsWith(".rels")){
|
if(entry.getName().endsWith(".xml") || entry.getName().endsWith(".vml") || entry.getName().endsWith(".rels")){
|
||||||
try {
|
try {
|
||||||
XmlObject xml = XmlObject.Factory.parse(zip.getInputStream(entry));
|
XmlObject xml = XmlObject.Factory.parse(zip.getInputStream(entry), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
XmlOptions options = new XmlOptions();
|
XmlOptions options = new XmlOptions();
|
||||||
options.setSavePrettyPrint();
|
options.setSavePrettyPrint();
|
||||||
xml.save(out, options);
|
xml.save(out, options);
|
||||||
|
@ -25,6 +25,7 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.poi.POIXMLDocumentPart;
|
||||||
import org.apache.poi.POIXMLException;
|
import org.apache.poi.POIXMLException;
|
||||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||||
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
|
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
|
||||||
@ -208,7 +209,7 @@ public class XSSFReader {
|
|||||||
}
|
}
|
||||||
//step 2. Read array of CTSheet elements, wrap it in a ArayList and construct an iterator
|
//step 2. Read array of CTSheet elements, wrap it in a ArayList and construct an iterator
|
||||||
//Note, using XMLBeans might be expensive, consider refactoring to use SAX or a plain regexp search
|
//Note, using XMLBeans might be expensive, consider refactoring to use SAX or a plain regexp search
|
||||||
CTWorkbook wbBean = WorkbookDocument.Factory.parse(wb.getInputStream()).getWorkbook();
|
CTWorkbook wbBean = WorkbookDocument.Factory.parse(wb.getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS).getWorkbook();
|
||||||
sheetIterator = wbBean.getSheets().getSheetList().iterator();
|
sheetIterator = wbBean.getSheets().getSheetList().iterator();
|
||||||
} catch (InvalidFormatException e){
|
} catch (InvalidFormatException e){
|
||||||
throw new POIXMLException(e);
|
throw new POIXMLException(e);
|
||||||
|
@ -25,6 +25,7 @@ import org.apache.xmlbeans.XmlException;
|
|||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.*;
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.*;
|
||||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The cells in a workbook can be calculated in different orders depending on various optimizations and
|
* The cells in a workbook can be calculated in different orders depending on various optimizations and
|
||||||
@ -47,7 +48,7 @@ public class CalculationChain extends POIXMLDocumentPart {
|
|||||||
|
|
||||||
public void readFrom(InputStream is) throws IOException {
|
public void readFrom(InputStream is) throws IOException {
|
||||||
try {
|
try {
|
||||||
CalcChainDocument doc = CalcChainDocument.Factory.parse(is);
|
CalcChainDocument doc = CalcChainDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
chain = doc.getCalcChain();
|
chain = doc.getCalcChain();
|
||||||
} catch (XmlException e) {
|
} catch (XmlException e) {
|
||||||
throw new IOException(e.getLocalizedMessage());
|
throw new IOException(e.getLocalizedMessage());
|
||||||
|
@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
import org.apache.poi.POIXMLDocumentPart;
|
import org.apache.poi.POIXMLDocumentPart;
|
||||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFComment;
|
import org.apache.poi.xssf.usermodel.XSSFComment;
|
||||||
import org.apache.xmlbeans.XmlException;
|
import org.apache.xmlbeans.XmlException;
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComment;
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComment;
|
||||||
@ -55,7 +56,7 @@ public class CommentsTable extends POIXMLDocumentPart {
|
|||||||
|
|
||||||
public void readFrom(InputStream is) throws IOException {
|
public void readFrom(InputStream is) throws IOException {
|
||||||
try {
|
try {
|
||||||
CommentsDocument doc = CommentsDocument.Factory.parse(is);
|
CommentsDocument doc = CommentsDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
comments = doc.getComments();
|
comments = doc.getComments();
|
||||||
} catch (XmlException e) {
|
} catch (XmlException e) {
|
||||||
throw new IOException(e.getLocalizedMessage());
|
throw new IOException(e.getLocalizedMessage());
|
||||||
|
@ -28,6 +28,7 @@ import org.apache.poi.openxml4j.opc.PackageRelationship;
|
|||||||
import org.apache.poi.openxml4j.opc.PackageRelationshipTypes;
|
import org.apache.poi.openxml4j.opc.PackageRelationshipTypes;
|
||||||
import org.apache.poi.openxml4j.opc.TargetMode;
|
import org.apache.poi.openxml4j.opc.TargetMode;
|
||||||
import org.apache.poi.ss.usermodel.Name;
|
import org.apache.poi.ss.usermodel.Name;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.xmlbeans.XmlException;
|
import org.apache.xmlbeans.XmlException;
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTExternalDefinedName;
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTExternalDefinedName;
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTExternalLink;
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTExternalLink;
|
||||||
@ -54,7 +55,7 @@ public class ExternalLinksTable extends POIXMLDocumentPart {
|
|||||||
|
|
||||||
public void readFrom(InputStream is) throws IOException {
|
public void readFrom(InputStream is) throws IOException {
|
||||||
try {
|
try {
|
||||||
ExternalLinkDocument doc = ExternalLinkDocument.Factory.parse(is);
|
ExternalLinkDocument doc = ExternalLinkDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
link = doc.getExternalLink();
|
link = doc.getExternalLink();
|
||||||
} catch (XmlException e) {
|
} catch (XmlException e) {
|
||||||
throw new IOException(e.getLocalizedMessage());
|
throw new IOException(e.getLocalizedMessage());
|
||||||
|
@ -27,6 +27,7 @@ import java.util.Map;
|
|||||||
import org.apache.poi.POIXMLDocumentPart;
|
import org.apache.poi.POIXMLDocumentPart;
|
||||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFMap;
|
import org.apache.poi.xssf.usermodel.XSSFMap;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
import org.apache.xmlbeans.XmlException;
|
import org.apache.xmlbeans.XmlException;
|
||||||
@ -68,7 +69,7 @@ public class MapInfo extends POIXMLDocumentPart {
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public void readFrom(InputStream is) throws IOException {
|
public void readFrom(InputStream is) throws IOException {
|
||||||
try {
|
try {
|
||||||
MapInfoDocument doc = MapInfoDocument.Factory.parse(is);
|
MapInfoDocument doc = MapInfoDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
mapInfo = doc.getMapInfo();
|
mapInfo = doc.getMapInfo();
|
||||||
|
|
||||||
maps= new HashMap<Integer, XSSFMap>();
|
maps= new HashMap<Integer, XSSFMap>();
|
||||||
|
@ -29,6 +29,7 @@ import java.util.Map;
|
|||||||
import org.apache.poi.POIXMLDocumentPart;
|
import org.apache.poi.POIXMLDocumentPart;
|
||||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.xmlbeans.XmlException;
|
import org.apache.xmlbeans.XmlException;
|
||||||
import org.apache.xmlbeans.XmlOptions;
|
import org.apache.xmlbeans.XmlOptions;
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRst;
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRst;
|
||||||
@ -116,7 +117,7 @@ public class SharedStringsTable extends POIXMLDocumentPart {
|
|||||||
public void readFrom(InputStream is) throws IOException {
|
public void readFrom(InputStream is) throws IOException {
|
||||||
try {
|
try {
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
_sstDoc = SstDocument.Factory.parse(is);
|
_sstDoc = SstDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
CTSst sst = _sstDoc.getSst();
|
CTSst sst = _sstDoc.getSst();
|
||||||
count = (int)sst.getCount();
|
count = (int)sst.getCount();
|
||||||
uniqueCount = (int)sst.getUniqueCount();
|
uniqueCount = (int)sst.getUniqueCount();
|
||||||
|
@ -26,6 +26,7 @@ import java.util.Vector;
|
|||||||
import org.apache.poi.POIXMLDocumentPart;
|
import org.apache.poi.POIXMLDocumentPart;
|
||||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||||
import org.apache.poi.xssf.usermodel.helpers.XSSFSingleXmlCell;
|
import org.apache.poi.xssf.usermodel.helpers.XSSFSingleXmlCell;
|
||||||
import org.apache.xmlbeans.XmlException;
|
import org.apache.xmlbeans.XmlException;
|
||||||
@ -61,7 +62,7 @@ public class SingleXmlCells extends POIXMLDocumentPart {
|
|||||||
|
|
||||||
public void readFrom(InputStream is) throws IOException {
|
public void readFrom(InputStream is) throws IOException {
|
||||||
try {
|
try {
|
||||||
SingleXmlCellsDocument doc = SingleXmlCellsDocument.Factory.parse(is);
|
SingleXmlCellsDocument doc = SingleXmlCellsDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
singleXMLCells = doc.getSingleXmlCells();
|
singleXMLCells = doc.getSingleXmlCells();
|
||||||
} catch (XmlException e) {
|
} catch (XmlException e) {
|
||||||
throw new IOException(e.getLocalizedMessage());
|
throw new IOException(e.getLocalizedMessage());
|
||||||
|
@ -34,6 +34,7 @@ import org.apache.poi.ss.SpreadsheetVersion;
|
|||||||
import org.apache.poi.ss.usermodel.BuiltinFormats;
|
import org.apache.poi.ss.usermodel.BuiltinFormats;
|
||||||
import org.apache.poi.ss.usermodel.FontFamily;
|
import org.apache.poi.ss.usermodel.FontFamily;
|
||||||
import org.apache.poi.ss.usermodel.FontScheme;
|
import org.apache.poi.ss.usermodel.FontScheme;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
|
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFFactory;
|
import org.apache.poi.xssf.usermodel.XSSFFactory;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFFont;
|
import org.apache.poi.xssf.usermodel.XSSFFont;
|
||||||
@ -147,7 +148,7 @@ public class StylesTable extends POIXMLDocumentPart {
|
|||||||
@SuppressWarnings("deprecation") //YK: getXYZArray() array accessors are deprecated in xmlbeans with JDK 1.5 support
|
@SuppressWarnings("deprecation") //YK: getXYZArray() array accessors are deprecated in xmlbeans with JDK 1.5 support
|
||||||
protected void readFrom(InputStream is) throws IOException {
|
protected void readFrom(InputStream is) throws IOException {
|
||||||
try {
|
try {
|
||||||
doc = StyleSheetDocument.Factory.parse(is);
|
doc = StyleSheetDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
|
|
||||||
CTStylesheet styleSheet = doc.getStyleSheet();
|
CTStylesheet styleSheet = doc.getStyleSheet();
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ import java.io.OutputStream;
|
|||||||
import org.apache.poi.POIXMLDocumentPart;
|
import org.apache.poi.POIXMLDocumentPart;
|
||||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFColor;
|
import org.apache.poi.xssf.usermodel.XSSFColor;
|
||||||
import org.apache.xmlbeans.XmlException;
|
import org.apache.xmlbeans.XmlException;
|
||||||
import org.apache.xmlbeans.XmlOptions;
|
import org.apache.xmlbeans.XmlOptions;
|
||||||
@ -80,7 +81,7 @@ public class ThemesTable extends POIXMLDocumentPart {
|
|||||||
super(part, rel);
|
super(part, rel);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
theme = ThemeDocument.Factory.parse(part.getInputStream());
|
theme = ThemeDocument.Factory.parse(part.getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
} catch(XmlException e) {
|
} catch(XmlException e) {
|
||||||
throw new IOException(e.getLocalizedMessage(), e);
|
throw new IOException(e.getLocalizedMessage(), e);
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
package org.apache.poi.xssf.usermodel;
|
package org.apache.poi.xssf.usermodel;
|
||||||
|
|
||||||
|
import org.apache.poi.POIXMLDocumentPart;
|
||||||
import org.apache.poi.POIXMLException;
|
import org.apache.poi.POIXMLException;
|
||||||
import org.apache.poi.ss.usermodel.BorderStyle;
|
import org.apache.poi.ss.usermodel.BorderStyle;
|
||||||
import org.apache.poi.ss.usermodel.CellStyle;
|
import org.apache.poi.ss.usermodel.CellStyle;
|
||||||
@ -153,12 +154,12 @@ public class XSSFCellStyle implements CellStyle {
|
|||||||
|
|
||||||
// Create a new Xf with the same contents
|
// Create a new Xf with the same contents
|
||||||
_cellXf = CTXf.Factory.parse(
|
_cellXf = CTXf.Factory.parse(
|
||||||
src.getCoreXf().toString()
|
src.getCoreXf().toString(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS
|
||||||
);
|
);
|
||||||
|
|
||||||
// bug 56295: ensure that the fills is available and set correctly
|
// bug 56295: ensure that the fills is available and set correctly
|
||||||
CTFill fill = CTFill.Factory.parse(
|
CTFill fill = CTFill.Factory.parse(
|
||||||
src.getCTFill().toString()
|
src.getCTFill().toString(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS
|
||||||
);
|
);
|
||||||
addFill(fill);
|
addFill(fill);
|
||||||
|
|
||||||
@ -177,7 +178,7 @@ public class XSSFCellStyle implements CellStyle {
|
|||||||
// Copy the font
|
// Copy the font
|
||||||
try {
|
try {
|
||||||
CTFont ctFont = CTFont.Factory.parse(
|
CTFont ctFont = CTFont.Factory.parse(
|
||||||
src.getFont().getCTFont().toString()
|
src.getFont().getCTFont().toString(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS
|
||||||
);
|
);
|
||||||
XSSFFont font = new XSSFFont(ctFont);
|
XSSFFont font = new XSSFFont(ctFont);
|
||||||
font.registerTo(_stylesSource);
|
font.registerTo(_stylesSource);
|
||||||
|
@ -34,6 +34,7 @@ import org.apache.poi.ss.usermodel.charts.AxisPosition;
|
|||||||
import org.apache.poi.ss.usermodel.charts.ChartAxis;
|
import org.apache.poi.ss.usermodel.charts.ChartAxis;
|
||||||
import org.apache.poi.ss.usermodel.charts.ChartAxisFactory;
|
import org.apache.poi.ss.usermodel.charts.ChartAxisFactory;
|
||||||
import org.apache.poi.ss.usermodel.charts.ChartData;
|
import org.apache.poi.ss.usermodel.charts.ChartData;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.poi.util.Internal;
|
import org.apache.poi.util.Internal;
|
||||||
import org.apache.poi.xssf.usermodel.charts.XSSFCategoryAxis;
|
import org.apache.poi.xssf.usermodel.charts.XSSFCategoryAxis;
|
||||||
import org.apache.poi.xssf.usermodel.charts.XSSFChartAxis;
|
import org.apache.poi.xssf.usermodel.charts.XSSFChartAxis;
|
||||||
@ -100,7 +101,7 @@ public final class XSSFChart extends POIXMLDocumentPart implements Chart, ChartA
|
|||||||
protected XSSFChart(PackagePart part, PackageRelationship rel) throws IOException, XmlException {
|
protected XSSFChart(PackagePart part, PackageRelationship rel) throws IOException, XmlException {
|
||||||
super(part, rel);
|
super(part, rel);
|
||||||
|
|
||||||
chartSpace = ChartSpaceDocument.Factory.parse(part.getInputStream()).getChartSpace();
|
chartSpace = ChartSpaceDocument.Factory.parse(part.getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS).getChartSpace();
|
||||||
chart = chartSpace.getChart();
|
chart = chartSpace.getChart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
import javax.xml.namespace.QName;
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
|
import org.apache.poi.POIXMLDocumentPart;
|
||||||
import org.apache.poi.POIXMLException;
|
import org.apache.poi.POIXMLException;
|
||||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||||
@ -61,7 +62,7 @@ public class XSSFChartSheet extends XSSFSheet {
|
|||||||
super.read(new ByteArrayInputStream(BLANK_WORKSHEET));
|
super.read(new ByteArrayInputStream(BLANK_WORKSHEET));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
chartsheet = ChartsheetDocument.Factory.parse(is).getChartsheet();
|
chartsheet = ChartsheetDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS).getChartsheet();
|
||||||
} catch (XmlException e){
|
} catch (XmlException e){
|
||||||
throw new POIXMLException(e);
|
throw new POIXMLException(e);
|
||||||
}
|
}
|
||||||
|
@ -66,6 +66,7 @@ import org.apache.poi.ss.util.CellReference;
|
|||||||
import org.apache.poi.ss.util.SSCellRange;
|
import org.apache.poi.ss.util.SSCellRange;
|
||||||
import org.apache.poi.ss.util.SheetUtil;
|
import org.apache.poi.ss.util.SheetUtil;
|
||||||
import org.apache.poi.util.Beta;
|
import org.apache.poi.util.Beta;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.poi.util.Internal;
|
import org.apache.poi.util.Internal;
|
||||||
import org.apache.poi.util.POILogFactory;
|
import org.apache.poi.util.POILogFactory;
|
||||||
import org.apache.poi.util.POILogger;
|
import org.apache.poi.util.POILogger;
|
||||||
@ -193,7 +194,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
|
|||||||
|
|
||||||
protected void read(InputStream is) throws IOException {
|
protected void read(InputStream is) throws IOException {
|
||||||
try {
|
try {
|
||||||
worksheet = WorksheetDocument.Factory.parse(is).getWorksheet();
|
worksheet = WorksheetDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS).getWorksheet();
|
||||||
} catch (XmlException e){
|
} catch (XmlException e){
|
||||||
throw new POIXMLException(e);
|
throw new POIXMLException(e);
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ import org.apache.poi.POIXMLDocumentPart;
|
|||||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||||
import org.apache.poi.ss.util.CellReference;
|
import org.apache.poi.ss.util.CellReference;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.poi.xssf.usermodel.helpers.XSSFXmlColumnPr;
|
import org.apache.poi.xssf.usermodel.helpers.XSSFXmlColumnPr;
|
||||||
import org.apache.xmlbeans.XmlException;
|
import org.apache.xmlbeans.XmlException;
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTable;
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTable;
|
||||||
@ -69,7 +70,7 @@ public class XSSFTable extends POIXMLDocumentPart {
|
|||||||
|
|
||||||
public void readFrom(InputStream is) throws IOException {
|
public void readFrom(InputStream is) throws IOException {
|
||||||
try {
|
try {
|
||||||
TableDocument doc = TableDocument.Factory.parse(is);
|
TableDocument doc = TableDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
ctTable = doc.getTable();
|
ctTable = doc.getTable();
|
||||||
} catch (XmlException e) {
|
} catch (XmlException e) {
|
||||||
throw new IOException(e.getLocalizedMessage());
|
throw new IOException(e.getLocalizedMessage());
|
||||||
|
@ -20,6 +20,7 @@ package org.apache.poi.xssf.usermodel;
|
|||||||
import org.apache.poi.POIXMLDocumentPart;
|
import org.apache.poi.POIXMLDocumentPart;
|
||||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.poi.xssf.util.EvilUnclosedBRFixingInputStream;
|
import org.apache.poi.xssf.util.EvilUnclosedBRFixingInputStream;
|
||||||
import org.apache.xmlbeans.XmlException;
|
import org.apache.xmlbeans.XmlException;
|
||||||
import org.apache.xmlbeans.XmlOptions;
|
import org.apache.xmlbeans.XmlOptions;
|
||||||
@ -106,7 +107,7 @@ public final class XSSFVMLDrawing extends POIXMLDocumentPart {
|
|||||||
|
|
||||||
protected void read(InputStream is) throws IOException, XmlException {
|
protected void read(InputStream is) throws IOException, XmlException {
|
||||||
XmlObject root = XmlObject.Factory.parse(
|
XmlObject root = XmlObject.Factory.parse(
|
||||||
new EvilUnclosedBRFixingInputStream(is)
|
new EvilUnclosedBRFixingInputStream(is), POIXMLDocumentPart.DEFAULT_XML_OPTIONS
|
||||||
);
|
);
|
||||||
|
|
||||||
_qnames = new ArrayList<QName>();
|
_qnames = new ArrayList<QName>();
|
||||||
@ -115,13 +116,13 @@ public final class XSSFVMLDrawing extends POIXMLDocumentPart {
|
|||||||
Node nd = obj.getDomNode();
|
Node nd = obj.getDomNode();
|
||||||
QName qname = new QName(nd.getNamespaceURI(), nd.getLocalName());
|
QName qname = new QName(nd.getNamespaceURI(), nd.getLocalName());
|
||||||
if (qname.equals(QNAME_SHAPE_LAYOUT)) {
|
if (qname.equals(QNAME_SHAPE_LAYOUT)) {
|
||||||
_items.add(CTShapeLayout.Factory.parse(obj.xmlText()));
|
_items.add(CTShapeLayout.Factory.parse(obj.xmlText(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS));
|
||||||
} else if (qname.equals(QNAME_SHAPE_TYPE)) {
|
} else if (qname.equals(QNAME_SHAPE_TYPE)) {
|
||||||
CTShapetype st = CTShapetype.Factory.parse(obj.xmlText());
|
CTShapetype st = CTShapetype.Factory.parse(obj.xmlText(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
_items.add(st);
|
_items.add(st);
|
||||||
_shapeTypeId = st.getId();
|
_shapeTypeId = st.getId();
|
||||||
} else if (qname.equals(QNAME_SHAPE)) {
|
} else if (qname.equals(QNAME_SHAPE)) {
|
||||||
CTShape shape = CTShape.Factory.parse(obj.xmlText());
|
CTShape shape = CTShape.Factory.parse(obj.xmlText(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
String id = shape.getId();
|
String id = shape.getId();
|
||||||
if(id != null) {
|
if(id != null) {
|
||||||
Matcher m = ptrn_shapeId.matcher(id);
|
Matcher m = ptrn_shapeId.matcher(id);
|
||||||
@ -129,7 +130,7 @@ public final class XSSFVMLDrawing extends POIXMLDocumentPart {
|
|||||||
}
|
}
|
||||||
_items.add(shape);
|
_items.add(shape);
|
||||||
} else {
|
} else {
|
||||||
_items.add(XmlObject.Factory.parse(obj.xmlText()));
|
_items.add(XmlObject.Factory.parse(obj.xmlText(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS));
|
||||||
}
|
}
|
||||||
_qnames.add(qname);
|
_qnames.add(qname);
|
||||||
}
|
}
|
||||||
|
@ -64,6 +64,7 @@ import org.apache.poi.ss.util.CellRangeAddress;
|
|||||||
import org.apache.poi.ss.util.CellReference;
|
import org.apache.poi.ss.util.CellReference;
|
||||||
import org.apache.poi.ss.util.WorkbookUtil;
|
import org.apache.poi.ss.util.WorkbookUtil;
|
||||||
import org.apache.poi.util.Beta;
|
import org.apache.poi.util.Beta;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.poi.util.IOUtils;
|
import org.apache.poi.util.IOUtils;
|
||||||
import org.apache.poi.util.Internal;
|
import org.apache.poi.util.Internal;
|
||||||
import org.apache.poi.util.POILogFactory;
|
import org.apache.poi.util.POILogFactory;
|
||||||
@ -333,7 +334,7 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook {
|
|||||||
@SuppressWarnings("deprecation") // getXYZArray() array accessors are deprecated
|
@SuppressWarnings("deprecation") // getXYZArray() array accessors are deprecated
|
||||||
protected void onDocumentRead() throws IOException {
|
protected void onDocumentRead() throws IOException {
|
||||||
try {
|
try {
|
||||||
WorkbookDocument doc = WorkbookDocument.Factory.parse(getPackagePart().getInputStream());
|
WorkbookDocument doc = WorkbookDocument.Factory.parse(getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
this.workbook = doc.getWorkbook();
|
this.workbook = doc.getWorkbook();
|
||||||
|
|
||||||
ThemesTable theme = null;
|
ThemesTable theme = null;
|
||||||
|
@ -48,6 +48,7 @@ import org.apache.poi.openxml4j.opc.PackageRelationshipTypes;
|
|||||||
import org.apache.poi.openxml4j.opc.PackagingURIHelper;
|
import org.apache.poi.openxml4j.opc.PackagingURIHelper;
|
||||||
import org.apache.poi.openxml4j.opc.TargetMode;
|
import org.apache.poi.openxml4j.opc.TargetMode;
|
||||||
import org.apache.poi.poifs.crypt.HashAlgorithm;
|
import org.apache.poi.poifs.crypt.HashAlgorithm;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.poi.util.IOUtils;
|
import org.apache.poi.util.IOUtils;
|
||||||
import org.apache.poi.util.IdentifierManager;
|
import org.apache.poi.util.IdentifierManager;
|
||||||
import org.apache.poi.util.Internal;
|
import org.apache.poi.util.Internal;
|
||||||
@ -155,7 +156,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
|
|||||||
@Override
|
@Override
|
||||||
protected void onDocumentRead() throws IOException {
|
protected void onDocumentRead() throws IOException {
|
||||||
try {
|
try {
|
||||||
DocumentDocument doc = DocumentDocument.Factory.parse(getPackagePart().getInputStream());
|
DocumentDocument doc = DocumentDocument.Factory.parse(getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
ctDocument = doc.getDocument();
|
ctDocument = doc.getDocument();
|
||||||
|
|
||||||
initFootnotes();
|
initFootnotes();
|
||||||
@ -205,7 +206,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
|
|||||||
header.onDocumentRead();
|
header.onDocumentRead();
|
||||||
} else if (relation.equals(XWPFRelation.COMMENT.getRelation())) {
|
} else if (relation.equals(XWPFRelation.COMMENT.getRelation())) {
|
||||||
// TODO Create according XWPFComment class, extending POIXMLDocumentPart
|
// TODO Create according XWPFComment class, extending POIXMLDocumentPart
|
||||||
CommentsDocument cmntdoc = CommentsDocument.Factory.parse(p.getPackagePart().getInputStream());
|
CommentsDocument cmntdoc = CommentsDocument.Factory.parse(p.getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
for (CTComment ctcomment : cmntdoc.getComments().getCommentArray()) {
|
for (CTComment ctcomment : cmntdoc.getComments().getCommentArray()) {
|
||||||
comments.add(new XWPFComment(ctcomment, this));
|
comments.add(new XWPFComment(ctcomment, this));
|
||||||
}
|
}
|
||||||
@ -262,7 +263,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
|
|||||||
this.footnotes = (XWPFFootnotes) p;
|
this.footnotes = (XWPFFootnotes) p;
|
||||||
this.footnotes.onDocumentRead();
|
this.footnotes.onDocumentRead();
|
||||||
} else if (relation.equals(XWPFRelation.ENDNOTE.getRelation())) {
|
} else if (relation.equals(XWPFRelation.ENDNOTE.getRelation())) {
|
||||||
EndnotesDocument endnotesDocument = EndnotesDocument.Factory.parse(p.getPackagePart().getInputStream());
|
EndnotesDocument endnotesDocument = EndnotesDocument.Factory.parse(p.getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
|
|
||||||
for (CTFtnEdn ctFtnEdn : endnotesDocument.getEndnotes().getEndnoteArray()) {
|
for (CTFtnEdn ctFtnEdn : endnotesDocument.getEndnotes().getEndnoteArray()) {
|
||||||
endnotes.put(ctFtnEdn.getId().intValue(), new XWPFFootnote(this, ctFtnEdn));
|
endnotes.put(ctFtnEdn.getId().intValue(), new XWPFFootnote(this, ctFtnEdn));
|
||||||
@ -452,7 +453,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
|
|||||||
throw new IllegalStateException("Expecting one Styles document part, but found " + parts.length);
|
throw new IllegalStateException("Expecting one Styles document part, but found " + parts.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
StylesDocument sd = StylesDocument.Factory.parse(parts[0].getInputStream());
|
StylesDocument sd = StylesDocument.Factory.parse(parts[0].getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
return sd.getStyles();
|
return sd.getStyles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ import org.apache.poi.POIXMLDocumentPart;
|
|||||||
import org.apache.poi.POIXMLException;
|
import org.apache.poi.POIXMLException;
|
||||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.xmlbeans.XmlCursor;
|
import org.apache.xmlbeans.XmlCursor;
|
||||||
import org.apache.xmlbeans.XmlObject;
|
import org.apache.xmlbeans.XmlObject;
|
||||||
import org.apache.xmlbeans.XmlOptions;
|
import org.apache.xmlbeans.XmlOptions;
|
||||||
@ -102,7 +103,7 @@ public class XWPFFooter extends XWPFHeaderFooter {
|
|||||||
InputStream is;
|
InputStream is;
|
||||||
try {
|
try {
|
||||||
is = getPackagePart().getInputStream();
|
is = getPackagePart().getInputStream();
|
||||||
ftrDocument = FtrDocument.Factory.parse(is);
|
ftrDocument = FtrDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
headerFooter = ftrDocument.getFtr();
|
headerFooter = ftrDocument.getFtr();
|
||||||
// parse the document with cursor and add
|
// parse the document with cursor and add
|
||||||
// the XmlObject to its lists
|
// the XmlObject to its lists
|
||||||
|
@ -32,6 +32,7 @@ import org.apache.poi.POIXMLException;
|
|||||||
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
|
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
|
||||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.xmlbeans.XmlException;
|
import org.apache.xmlbeans.XmlException;
|
||||||
import org.apache.xmlbeans.XmlOptions;
|
import org.apache.xmlbeans.XmlOptions;
|
||||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFootnotes;
|
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFootnotes;
|
||||||
@ -71,7 +72,7 @@ public class XWPFFootnotes extends POIXMLDocumentPart {
|
|||||||
FootnotesDocument notesDoc;
|
FootnotesDocument notesDoc;
|
||||||
try {
|
try {
|
||||||
InputStream is = getPackagePart().getInputStream();
|
InputStream is = getPackagePart().getInputStream();
|
||||||
notesDoc = FootnotesDocument.Factory.parse(is);
|
notesDoc = FootnotesDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
ctFootnotes = notesDoc.getFootnotes();
|
ctFootnotes = notesDoc.getFootnotes();
|
||||||
} catch (XmlException e) {
|
} catch (XmlException e) {
|
||||||
throw new POIXMLException();
|
throw new POIXMLException();
|
||||||
|
@ -28,6 +28,7 @@ import org.apache.poi.POIXMLDocumentPart;
|
|||||||
import org.apache.poi.POIXMLException;
|
import org.apache.poi.POIXMLException;
|
||||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.xmlbeans.XmlCursor;
|
import org.apache.xmlbeans.XmlCursor;
|
||||||
import org.apache.xmlbeans.XmlException;
|
import org.apache.xmlbeans.XmlException;
|
||||||
import org.apache.xmlbeans.XmlObject;
|
import org.apache.xmlbeans.XmlObject;
|
||||||
@ -105,7 +106,7 @@ public class XWPFHeader extends XWPFHeaderFooter {
|
|||||||
InputStream is;
|
InputStream is;
|
||||||
try {
|
try {
|
||||||
is = getPackagePart().getInputStream();
|
is = getPackagePart().getInputStream();
|
||||||
hdrDocument = HdrDocument.Factory.parse(is);
|
hdrDocument = HdrDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
headerFooter = hdrDocument.getHdr();
|
headerFooter = hdrDocument.getHdr();
|
||||||
// parse the document with cursor and add
|
// parse the document with cursor and add
|
||||||
// the XmlObject to its lists
|
// the XmlObject to its lists
|
||||||
|
@ -32,6 +32,7 @@ import org.apache.poi.POIXMLException;
|
|||||||
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
|
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
|
||||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.xmlbeans.XmlException;
|
import org.apache.xmlbeans.XmlException;
|
||||||
import org.apache.xmlbeans.XmlOptions;
|
import org.apache.xmlbeans.XmlOptions;
|
||||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTAbstractNum;
|
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTAbstractNum;
|
||||||
@ -75,7 +76,7 @@ public class XWPFNumbering extends POIXMLDocumentPart {
|
|||||||
InputStream is;
|
InputStream is;
|
||||||
is = getPackagePart().getInputStream();
|
is = getPackagePart().getInputStream();
|
||||||
try {
|
try {
|
||||||
numberingDoc = NumberingDocument.Factory.parse(is);
|
numberingDoc = NumberingDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
ctNumbering = numberingDoc.getNumbering();
|
ctNumbering = numberingDoc.getNumbering();
|
||||||
//get any Nums
|
//get any Nums
|
||||||
for (CTNum ctNum : ctNumbering.getNumArray()) {
|
for (CTNum ctNum : ctNumbering.getNumArray()) {
|
||||||
|
@ -25,6 +25,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.xml.namespace.QName;
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
|
import org.apache.poi.POIXMLDocumentPart;
|
||||||
import org.apache.poi.POIXMLException;
|
import org.apache.poi.POIXMLException;
|
||||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||||
import org.apache.poi.util.Internal;
|
import org.apache.poi.util.Internal;
|
||||||
@ -175,7 +176,7 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun {
|
|||||||
if (pict instanceof XmlAnyTypeImpl) {
|
if (pict instanceof XmlAnyTypeImpl) {
|
||||||
// Pesky XmlBeans bug - see Bugzilla #49934
|
// Pesky XmlBeans bug - see Bugzilla #49934
|
||||||
try {
|
try {
|
||||||
pict = CTPicture.Factory.parse(pict.toString());
|
pict = CTPicture.Factory.parse(pict.toString(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
} catch (XmlException e) {
|
} catch (XmlException e) {
|
||||||
throw new POIXMLException(e);
|
throw new POIXMLException(e);
|
||||||
}
|
}
|
||||||
@ -945,7 +946,7 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun {
|
|||||||
"<pic:pic xmlns:pic=\"" + CTPicture.type.getName().getNamespaceURI() + "\" />" +
|
"<pic:pic xmlns:pic=\"" + CTPicture.type.getName().getNamespaceURI() + "\" />" +
|
||||||
"</a:graphicData>" +
|
"</a:graphicData>" +
|
||||||
"</a:graphic>";
|
"</a:graphic>";
|
||||||
inline.set(XmlToken.Factory.parse(xml));
|
inline.set(XmlToken.Factory.parse(xml, POIXMLDocumentPart.DEFAULT_XML_OPTIONS));
|
||||||
|
|
||||||
// Setup the inline
|
// Setup the inline
|
||||||
inline.setDistT(0);
|
inline.setDistT(0);
|
||||||
|
@ -33,6 +33,7 @@ import org.apache.poi.openxml4j.opc.PackagePart;
|
|||||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||||
import org.apache.poi.poifs.crypt.CryptoFunctions;
|
import org.apache.poi.poifs.crypt.CryptoFunctions;
|
||||||
import org.apache.poi.poifs.crypt.HashAlgorithm;
|
import org.apache.poi.poifs.crypt.HashAlgorithm;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.xmlbeans.XmlOptions;
|
import org.apache.xmlbeans.XmlOptions;
|
||||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDocProtect;
|
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDocProtect;
|
||||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff;
|
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff;
|
||||||
@ -403,7 +404,7 @@ public class XWPFSettings extends POIXMLDocumentPart {
|
|||||||
|
|
||||||
private void readFrom(InputStream inputStream) {
|
private void readFrom(InputStream inputStream) {
|
||||||
try {
|
try {
|
||||||
ctSettings = SettingsDocument.Factory.parse(inputStream).getSettings();
|
ctSettings = SettingsDocument.Factory.parse(inputStream, POIXMLDocumentPart.DEFAULT_XML_OPTIONS).getSettings();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ import org.apache.poi.POIXMLException;
|
|||||||
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
|
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
|
||||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||||
|
import org.apache.poi.util.DocumentHelper;
|
||||||
import org.apache.xmlbeans.XmlException;
|
import org.apache.xmlbeans.XmlException;
|
||||||
import org.apache.xmlbeans.XmlOptions;
|
import org.apache.xmlbeans.XmlOptions;
|
||||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDocDefaults;
|
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDocDefaults;
|
||||||
@ -82,7 +83,7 @@ public class XWPFStyles extends POIXMLDocumentPart {
|
|||||||
StylesDocument stylesDoc;
|
StylesDocument stylesDoc;
|
||||||
try {
|
try {
|
||||||
InputStream is = getPackagePart().getInputStream();
|
InputStream is = getPackagePart().getInputStream();
|
||||||
stylesDoc = StylesDocument.Factory.parse(is);
|
stylesDoc = StylesDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||||
setStyles(stylesDoc.getStyles());
|
setStyles(stylesDoc.getStyles());
|
||||||
latentStyles = new XWPFLatentStyles(ctStyles.getLatentStyles(), this);
|
latentStyles = new XWPFLatentStyles(ctStyles.getLatentStyles(), this);
|
||||||
} catch (XmlException e) {
|
} catch (XmlException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user