git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1709128 13f79535-47bb-0310-9956-ffa450edef68tags/REL_3_14_BETA1
@@ -61,6 +61,7 @@ public class POIXMLDocumentPart { | |||
DEFAULT_XML_OPTIONS.setUseDefaultNamespace(); | |||
DEFAULT_XML_OPTIONS.setSaveAggressiveNamespaces(); | |||
DEFAULT_XML_OPTIONS.setCharacterEncoding("UTF-8"); | |||
DEFAULT_XML_OPTIONS.setLoadEntityBytesLimit(4096); | |||
} | |||
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.internal.PackagePropertiesPart; | |||
import org.apache.poi.openxml4j.util.Nullable; | |||
import org.apache.poi.util.DocumentHelper; | |||
import org.apache.xmlbeans.XmlException; | |||
import org.apache.xmlbeans.XmlOptions; | |||
import org.openxmlformats.schemas.officeDocument.x2006.customProperties.CTProperty; | |||
@@ -73,7 +74,7 @@ public class POIXMLProperties { | |||
if(extRel.size() == 1) { | |||
extPart = pkg.getPart( extRel.getRelationship(0)); | |||
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); | |||
} else { | |||
@@ -87,7 +88,7 @@ public class POIXMLProperties { | |||
if(custRel.size() == 1) { | |||
custPart = pkg.getPart( custRel.getRelationship(0)); | |||
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); | |||
} else { |
@@ -20,6 +20,7 @@ import java.io.IOException; | |||
import java.io.InputStream; | |||
import org.apache.poi.EncryptedDocumentException; | |||
import org.apache.poi.POIXMLDocumentPart; | |||
import org.apache.poi.poifs.crypt.ChainingMode; | |||
import org.apache.poi.poifs.crypt.CipherAlgorithm; | |||
import org.apache.poi.poifs.crypt.EncryptionInfo; | |||
@@ -111,7 +112,7 @@ public class AgileEncryptionInfoBuilder implements EncryptionInfoBuilder { | |||
protected static EncryptionDocument parseDescriptor(String descriptor) { | |||
try { | |||
return EncryptionDocument.Factory.parse(descriptor); | |||
return EncryptionDocument.Factory.parse(descriptor, POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
} catch (XmlException 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) { | |||
try { | |||
return EncryptionDocument.Factory.parse(descriptor); | |||
return EncryptionDocument.Factory.parse(descriptor, POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
} catch (Exception 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.DOMSignedInfo; | |||
import org.apache.poi.EncryptedDocumentException; | |||
import org.apache.poi.POIXMLDocumentPart; | |||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException; | |||
import org.apache.poi.openxml4j.opc.ContentTypes; | |||
import org.apache.poi.openxml4j.opc.OPCPackage; | |||
@@ -212,7 +213,7 @@ public class SignatureInfo implements SignatureConfigurable { | |||
*/ | |||
public SignatureDocument getSignatureDocument() throws IOException, XmlException { | |||
// 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 { | |||
OutputStream os = sigPart.getOutputStream(); | |||
SignatureDocument sigDoc = SignatureDocument.Factory.parse(document); | |||
SignatureDocument sigDoc = SignatureDocument.Factory.parse(document, POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
sigDoc.save(os, xo); | |||
os.close(); | |||
} catch (Exception e) { |
@@ -26,6 +26,7 @@ package org.apache.poi.poifs.crypt.dsig.facets; | |||
import javax.xml.crypto.MarshalException; | |||
import org.apache.poi.POIXMLDocumentPart; | |||
import org.apache.xmlbeans.XmlException; | |||
import org.etsi.uri.x01903.v13.QualifyingPropertiesType; | |||
import org.etsi.uri.x01903.v13.UnsignedPropertiesType; | |||
@@ -56,7 +57,7 @@ public class Office2010SignatureFacet extends SignatureFacet { | |||
QualifyingPropertiesType qualProps; | |||
try { | |||
qualProps = QualifyingPropertiesType.Factory.parse(nl.item(0)); | |||
qualProps = QualifyingPropertiesType.Factory.parse(nl.item(0), POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
} catch (XmlException e) { | |||
throw new MarshalException(e); | |||
} |
@@ -46,6 +46,7 @@ import java.util.UUID; | |||
import javax.xml.crypto.MarshalException; | |||
import org.apache.poi.POIXMLDocumentPart; | |||
import org.apache.poi.poifs.crypt.dsig.services.RevocationData; | |||
import org.apache.poi.util.POILogFactory; | |||
import org.apache.poi.util.POILogger; | |||
@@ -128,7 +129,7 @@ public class XAdESXLSignatureFacet extends SignatureFacet { | |||
NodeList qualNl = document.getElementsByTagNameNS(XADES_132_NS, "QualifyingProperties"); | |||
if (qualNl.getLength() == 1) { | |||
try { | |||
qualDoc = QualifyingPropertiesDocument.Factory.parse(qualNl.item(0)); | |||
qualDoc = QualifyingPropertiesDocument.Factory.parse(qualNl.item(0), POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
} catch (XmlException 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.spec.TransformParameterSpec; | |||
import org.apache.poi.POIXMLDocumentPart; | |||
import org.apache.poi.util.POILogFactory; | |||
import org.apache.poi.util.POILogger; | |||
import org.apache.poi.util.XmlSort; | |||
@@ -141,7 +142,7 @@ public class RelationshipTransformService extends TransformService { | |||
Node parentNode = domParent.getNode(); | |||
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()); | |||
if (xoList.length == 0) { | |||
LOG.log(POILogger.WARN, "no RelationshipReference/@SourceId parameters present"); | |||
@@ -187,7 +188,7 @@ public class RelationshipTransformService extends TransformService { | |||
RelationshipsDocument relDoc; | |||
try { | |||
relDoc = RelationshipsDocument.Factory.parse(octetStream); | |||
relDoc = RelationshipsDocument.Factory.parse(octetStream, POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
} catch (Exception e) { | |||
throw new TransformException(e.getMessage(), e); | |||
} |
@@ -33,7 +33,7 @@ import org.xml.sax.SAXException; | |||
public final class DocumentHelper { | |||
private static POILogger logger = POILogFactory.getLogger(DocumentHelper.class); | |||
private DocumentHelper() {} | |||
/** |
@@ -23,6 +23,7 @@ import java.util.Comparator; | |||
import javax.xml.namespace.QName; | |||
import org.apache.poi.POIXMLDocumentPart; | |||
import org.apache.xmlbeans.XmlCursor; | |||
import org.apache.xmlbeans.XmlException; | |||
import org.apache.xmlbeans.XmlObject; | |||
@@ -49,7 +50,7 @@ public final class XmlSort | |||
File f = new File(args[0]); | |||
try | |||
{ | |||
XmlObject docInstance = XmlObject.Factory.parse(f); | |||
XmlObject docInstance = XmlObject.Factory.parse(f, POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
XmlObject element = null; | |||
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.SlideShow; | |||
import org.apache.poi.util.Beta; | |||
import org.apache.poi.util.DocumentHelper; | |||
import org.apache.poi.util.IOUtils; | |||
import org.apache.poi.util.Internal; | |||
import org.apache.poi.util.LittleEndian; | |||
@@ -127,7 +128,7 @@ implements SlideShow<XSLFShape,XSLFTextParagraph> { | |||
protected void onDocumentRead() throws IOException { | |||
try { | |||
PresentationDocument doc = | |||
PresentationDocument.Factory.parse(getCorePart().getInputStream()); | |||
PresentationDocument.Factory.parse(getCorePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
_presentation = doc.getPresentation(); | |||
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.PackageRelationship; | |||
import org.apache.poi.util.Beta; | |||
import org.apache.poi.util.DocumentHelper; | |||
import org.apache.poi.util.Internal; | |||
import org.apache.xmlbeans.XmlException; | |||
import org.apache.xmlbeans.XmlOptions; | |||
@@ -65,7 +66,7 @@ public final class XSLFChart extends POIXMLDocumentPart { | |||
protected XSLFChart(PackagePart part, PackageRelationship rel) throws IOException, XmlException { | |||
super(part, rel); | |||
chartSpace = ChartSpaceDocument.Factory.parse(part.getInputStream()).getChartSpace(); | |||
chartSpace = ChartSpaceDocument.Factory.parse(part.getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS).getChartSpace(); | |||
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.PackageRelationship; | |||
import org.apache.poi.util.Beta; | |||
import org.apache.poi.util.DocumentHelper; | |||
import org.apache.xmlbeans.XmlException; | |||
import org.openxmlformats.schemas.presentationml.x2006.main.CTCommentAuthor; | |||
import org.openxmlformats.schemas.presentationml.x2006.main.CTCommentAuthorList; | |||
@@ -53,7 +54,7 @@ public class XSLFCommentAuthors extends POIXMLDocumentPart { | |||
super(part, rel); | |||
CmAuthorLstDocument doc = | |||
CmAuthorLstDocument.Factory.parse(getPackagePart().getInputStream()); | |||
CmAuthorLstDocument.Factory.parse(getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
_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.PackageRelationship; | |||
import org.apache.poi.util.Beta; | |||
import org.apache.poi.util.DocumentHelper; | |||
import org.apache.xmlbeans.XmlException; | |||
import org.openxmlformats.schemas.presentationml.x2006.main.CTComment; | |||
import org.openxmlformats.schemas.presentationml.x2006.main.CTCommentList; | |||
@@ -53,7 +54,7 @@ public class XSLFComments extends POIXMLDocumentPart { | |||
super(part, rel); | |||
CmLstDocument doc = | |||
CmLstDocument.Factory.parse(getPackagePart().getInputStream()); | |||
CmLstDocument.Factory.parse(getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
_comments = doc.getCmLst(); | |||
} | |||
@@ -21,6 +21,7 @@ import java.util.ArrayList; | |||
import java.util.Arrays; | |||
import java.util.List; | |||
import org.apache.poi.POIXMLDocumentPart; | |||
import org.apache.poi.POIXMLException; | |||
import org.apache.poi.util.Beta; | |||
import org.apache.xmlbeans.XmlCursor; | |||
@@ -67,7 +68,7 @@ public class XSLFCommonSlideData { | |||
if (o instanceof XmlAnyTypeImpl) { | |||
// Pesky XmlBeans bug - see Bugzilla #49934 | |||
try { | |||
o = CTTable.Factory.parse(o.toString()); | |||
o = CTTable.Factory.parse(o.toString(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
} catch (XmlException 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.sl.usermodel.Notes; | |||
import org.apache.poi.util.Beta; | |||
import org.apache.poi.util.DocumentHelper; | |||
import org.apache.xmlbeans.XmlException; | |||
import org.openxmlformats.schemas.presentationml.x2006.main.CTCommonSlideData; | |||
import org.openxmlformats.schemas.presentationml.x2006.main.CTNotesSlide; | |||
@@ -56,7 +57,7 @@ implements Notes<XSLFShape,XSLFTextParagraph> { | |||
super(part, rel); | |||
NotesDocument doc = | |||
NotesDocument.Factory.parse(getPackagePart().getInputStream()); | |||
NotesDocument.Factory.parse(getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
_notes = doc.getNotes(); | |||
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.sl.usermodel.MasterSheet; | |||
import org.apache.poi.util.Beta; | |||
import org.apache.poi.util.DocumentHelper; | |||
import org.apache.xmlbeans.XmlException; | |||
import org.openxmlformats.schemas.drawingml.x2006.main.CTColorMapping; | |||
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 { | |||
super(part, rel); | |||
NotesMasterDocument doc = | |||
NotesMasterDocument.Factory.parse(getPackagePart().getInputStream()); | |||
NotesMasterDocument.Factory.parse(getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
_slide = doc.getNotesMaster(); | |||
setCommonSlideData(_slide.getCSld()); | |||
} | |||
@@ -73,7 +74,7 @@ import org.openxmlformats.schemas.presentationml.x2006.main.NotesMasterDocument; | |||
try { | |||
try { | |||
NotesMasterDocument doc = NotesMasterDocument.Factory.parse(is); | |||
NotesMasterDocument doc = NotesMasterDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
CTNotesMaster slide = doc.getNotesMaster(); | |||
return slide; | |||
} 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.Slide; | |||
import org.apache.poi.util.Beta; | |||
import org.apache.poi.util.DocumentHelper; | |||
import org.apache.xmlbeans.XmlException; | |||
import org.openxmlformats.schemas.drawingml.x2006.main.CTBlip; | |||
import org.openxmlformats.schemas.drawingml.x2006.main.CTGroupShapeProperties; | |||
@@ -70,7 +71,7 @@ implements Slide<XSLFShape,XSLFTextParagraph> { | |||
super(part, rel); | |||
SldDocument doc = | |||
SldDocument.Factory.parse(getPackagePart().getInputStream()); | |||
SldDocument.Factory.parse(getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
_slide = doc.getSld(); | |||
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.sl.usermodel.MasterSheet; | |||
import org.apache.poi.util.Beta; | |||
import org.apache.poi.util.DocumentHelper; | |||
import org.apache.poi.util.Internal; | |||
import org.apache.xmlbeans.XmlException; | |||
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 { | |||
super(part, rel); | |||
SldLayoutDocument doc = | |||
SldLayoutDocument.Factory.parse(getPackagePart().getInputStream()); | |||
SldLayoutDocument.Factory.parse(getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
_layout = doc.getSldLayout(); | |||
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.sl.usermodel.MasterSheet; | |||
import org.apache.poi.util.Beta; | |||
import org.apache.poi.util.DocumentHelper; | |||
import org.apache.xmlbeans.XmlException; | |||
import org.openxmlformats.schemas.drawingml.x2006.main.CTColorMapping; | |||
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 { | |||
super(part, rel); | |||
SldMasterDocument doc = | |||
SldMasterDocument.Factory.parse(getPackagePart().getInputStream()); | |||
SldMasterDocument.Factory.parse(getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
_slide = doc.getSldMaster(); | |||
setCommonSlideData(_slide.getCSld()); | |||
} |
@@ -21,6 +21,7 @@ import java.util.LinkedList; | |||
import java.util.List; | |||
import org.apache.poi.POIXMLDocument; | |||
import org.apache.poi.POIXMLDocumentPart; | |||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException; | |||
import org.apache.poi.openxml4j.exceptions.OpenXML4JException; | |||
import org.apache.poi.openxml4j.opc.OPCPackage; | |||
@@ -73,7 +74,7 @@ public class XSLFSlideShow extends POIXMLDocument { | |||
} | |||
presentationDoc = | |||
PresentationDocument.Factory.parse(getCorePart().getInputStream()); | |||
PresentationDocument.Factory.parse(getCorePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
embedds = new LinkedList<PackagePart>(); | |||
for (CTSlideIdListEntry ctSlide : getSlideReferences().getSldIdArray()) { | |||
@@ -145,7 +146,7 @@ public class XSLFSlideShow extends POIXMLDocument { | |||
public CTSlideMaster getSlideMaster(CTSlideMasterIdListEntry master) throws IOException, XmlException { | |||
PackagePart masterPart = getSlideMasterPart(master); | |||
SldMasterDocument masterDoc = | |||
SldMasterDocument.Factory.parse(masterPart.getInputStream()); | |||
SldMasterDocument.Factory.parse(masterPart.getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
return masterDoc.getSldMaster(); | |||
} | |||
@@ -165,7 +166,7 @@ public class XSLFSlideShow extends POIXMLDocument { | |||
public CTSlide getSlide(CTSlideIdListEntry slide) throws IOException, XmlException { | |||
PackagePart slidePart = getSlidePart(slide); | |||
SldDocument slideDoc = | |||
SldDocument.Factory.parse(slidePart.getInputStream()); | |||
SldDocument.Factory.parse(slidePart.getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
return slideDoc.getSld(); | |||
} | |||
@@ -208,7 +209,7 @@ public class XSLFSlideShow extends POIXMLDocument { | |||
return null; | |||
NotesDocument notesDoc = | |||
NotesDocument.Factory.parse(notesPart.getInputStream()); | |||
NotesDocument.Factory.parse(notesPart.getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
return notesDoc.getNotes(); | |||
} | |||
@@ -240,7 +241,7 @@ public class XSLFSlideShow extends POIXMLDocument { | |||
commentRels.getRelationship(0) | |||
); | |||
CmLstDocument commDoc = | |||
CmLstDocument.Factory.parse(cPart.getInputStream()); | |||
CmLstDocument.Factory.parse(cPart.getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
return commDoc.getCmLst(); | |||
} catch(InvalidFormatException e) { | |||
throw new IllegalStateException(e); |
@@ -26,6 +26,7 @@ import java.util.List; | |||
import javax.xml.namespace.QName; | |||
import org.apache.poi.POIXMLDocumentPart; | |||
import org.apache.poi.POIXMLException; | |||
import org.apache.poi.sl.usermodel.TableShape; | |||
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 | |||
if(rs[0] instanceof XmlAnyTypeImpl){ | |||
try { | |||
rs[0] = CTTable.Factory.parse(rs[0].toString()); | |||
rs[0] = CTTable.Factory.parse(rs[0].toString(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
}catch (XmlException 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.PackageRelationship; | |||
import org.apache.poi.util.Beta; | |||
import org.apache.poi.util.DocumentHelper; | |||
import org.apache.xmlbeans.XmlException; | |||
import org.openxmlformats.schemas.drawingml.x2006.main.CTTableStyle; | |||
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 { | |||
super(part, rel); | |||
_tblStyleLst = CTTableStyleList.Factory.parse(getPackagePart().getInputStream()); | |||
_tblStyleLst = CTTableStyleList.Factory.parse(getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
CTTableStyle[] tblStyleArray = _tblStyleLst.getTblStyleArray(); | |||
_styles = new ArrayList<XSLFTableStyle>(tblStyleArray.length); | |||
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.PackageRelationship; | |||
import org.apache.poi.util.Beta; | |||
import org.apache.poi.util.DocumentHelper; | |||
import org.apache.poi.util.Internal; | |||
import org.apache.xmlbeans.XmlException; | |||
import org.apache.xmlbeans.XmlObject; | |||
@@ -57,7 +58,7 @@ public class XSLFTheme extends POIXMLDocumentPart { | |||
public XSLFTheme(PackagePart part, PackageRelationship rel) throws IOException, XmlException { | |||
super(part, rel); | |||
ThemeDocument doc = | |||
ThemeDocument.Factory.parse(getPackagePart().getInputStream()); | |||
ThemeDocument.Factory.parse(getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
_theme = doc.getTheme(); | |||
initialize(); | |||
} |
@@ -24,6 +24,7 @@ import java.util.Enumeration; | |||
import java.util.zip.ZipEntry; | |||
import java.util.zip.ZipFile; | |||
import org.apache.poi.POIXMLDocumentPart; | |||
import org.apache.poi.openxml4j.opc.internal.ZipHelper; | |||
import org.apache.poi.util.IOUtils; | |||
import org.apache.xmlbeans.XmlObject; | |||
@@ -70,7 +71,7 @@ public final class XSSFDump { | |||
try { | |||
if(entry.getName().endsWith(".xml") || entry.getName().endsWith(".vml") || entry.getName().endsWith(".rels")){ | |||
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(); | |||
options.setSavePrettyPrint(); | |||
xml.save(out, options); |
@@ -25,6 +25,7 @@ import java.util.LinkedList; | |||
import java.util.List; | |||
import java.util.Map; | |||
import org.apache.poi.POIXMLDocumentPart; | |||
import org.apache.poi.POIXMLException; | |||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException; | |||
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 | |||
//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(); | |||
} catch (InvalidFormatException e){ | |||
throw new POIXMLException(e); |
@@ -25,6 +25,7 @@ import org.apache.xmlbeans.XmlException; | |||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.*; | |||
import org.apache.poi.openxml4j.opc.PackagePart; | |||
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 | |||
@@ -47,7 +48,7 @@ public class CalculationChain extends POIXMLDocumentPart { | |||
public void readFrom(InputStream is) throws IOException { | |||
try { | |||
CalcChainDocument doc = CalcChainDocument.Factory.parse(is); | |||
CalcChainDocument doc = CalcChainDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
chain = doc.getCalcChain(); | |||
} catch (XmlException e) { | |||
throw new IOException(e.getLocalizedMessage()); |
@@ -25,6 +25,7 @@ import java.util.Map; | |||
import org.apache.poi.POIXMLDocumentPart; | |||
import org.apache.poi.openxml4j.opc.PackagePart; | |||
import org.apache.poi.openxml4j.opc.PackageRelationship; | |||
import org.apache.poi.util.DocumentHelper; | |||
import org.apache.poi.xssf.usermodel.XSSFComment; | |||
import org.apache.xmlbeans.XmlException; | |||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComment; | |||
@@ -55,7 +56,7 @@ public class CommentsTable extends POIXMLDocumentPart { | |||
public void readFrom(InputStream is) throws IOException { | |||
try { | |||
CommentsDocument doc = CommentsDocument.Factory.parse(is); | |||
CommentsDocument doc = CommentsDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
comments = doc.getComments(); | |||
} catch (XmlException e) { | |||
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.TargetMode; | |||
import org.apache.poi.ss.usermodel.Name; | |||
import org.apache.poi.util.DocumentHelper; | |||
import org.apache.xmlbeans.XmlException; | |||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTExternalDefinedName; | |||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTExternalLink; | |||
@@ -54,7 +55,7 @@ public class ExternalLinksTable extends POIXMLDocumentPart { | |||
public void readFrom(InputStream is) throws IOException { | |||
try { | |||
ExternalLinkDocument doc = ExternalLinkDocument.Factory.parse(is); | |||
ExternalLinkDocument doc = ExternalLinkDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
link = doc.getExternalLink(); | |||
} catch (XmlException e) { | |||
throw new IOException(e.getLocalizedMessage()); |
@@ -27,6 +27,7 @@ import java.util.Map; | |||
import org.apache.poi.POIXMLDocumentPart; | |||
import org.apache.poi.openxml4j.opc.PackagePart; | |||
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.XSSFWorkbook; | |||
import org.apache.xmlbeans.XmlException; | |||
@@ -68,7 +69,7 @@ public class MapInfo extends POIXMLDocumentPart { | |||
@SuppressWarnings("deprecation") | |||
public void readFrom(InputStream is) throws IOException { | |||
try { | |||
MapInfoDocument doc = MapInfoDocument.Factory.parse(is); | |||
MapInfoDocument doc = MapInfoDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
mapInfo = doc.getMapInfo(); | |||
maps= new HashMap<Integer, XSSFMap>(); |
@@ -29,6 +29,7 @@ import java.util.Map; | |||
import org.apache.poi.POIXMLDocumentPart; | |||
import org.apache.poi.openxml4j.opc.PackagePart; | |||
import org.apache.poi.openxml4j.opc.PackageRelationship; | |||
import org.apache.poi.util.DocumentHelper; | |||
import org.apache.xmlbeans.XmlException; | |||
import org.apache.xmlbeans.XmlOptions; | |||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRst; | |||
@@ -116,7 +117,7 @@ public class SharedStringsTable extends POIXMLDocumentPart { | |||
public void readFrom(InputStream is) throws IOException { | |||
try { | |||
int cnt = 0; | |||
_sstDoc = SstDocument.Factory.parse(is); | |||
_sstDoc = SstDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
CTSst sst = _sstDoc.getSst(); | |||
count = (int)sst.getCount(); | |||
uniqueCount = (int)sst.getUniqueCount(); |
@@ -26,6 +26,7 @@ import java.util.Vector; | |||
import org.apache.poi.POIXMLDocumentPart; | |||
import org.apache.poi.openxml4j.opc.PackagePart; | |||
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.helpers.XSSFSingleXmlCell; | |||
import org.apache.xmlbeans.XmlException; | |||
@@ -61,7 +62,7 @@ public class SingleXmlCells extends POIXMLDocumentPart { | |||
public void readFrom(InputStream is) throws IOException { | |||
try { | |||
SingleXmlCellsDocument doc = SingleXmlCellsDocument.Factory.parse(is); | |||
SingleXmlCellsDocument doc = SingleXmlCellsDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
singleXMLCells = doc.getSingleXmlCells(); | |||
} catch (XmlException e) { | |||
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.FontFamily; | |||
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.XSSFFactory; | |||
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 | |||
protected void readFrom(InputStream is) throws IOException { | |||
try { | |||
doc = StyleSheetDocument.Factory.parse(is); | |||
doc = StyleSheetDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
CTStylesheet styleSheet = doc.getStyleSheet(); | |||
@@ -22,6 +22,7 @@ import java.io.OutputStream; | |||
import org.apache.poi.POIXMLDocumentPart; | |||
import org.apache.poi.openxml4j.opc.PackagePart; | |||
import org.apache.poi.openxml4j.opc.PackageRelationship; | |||
import org.apache.poi.util.DocumentHelper; | |||
import org.apache.poi.xssf.usermodel.XSSFColor; | |||
import org.apache.xmlbeans.XmlException; | |||
import org.apache.xmlbeans.XmlOptions; | |||
@@ -80,7 +81,7 @@ public class ThemesTable extends POIXMLDocumentPart { | |||
super(part, rel); | |||
try { | |||
theme = ThemeDocument.Factory.parse(part.getInputStream()); | |||
theme = ThemeDocument.Factory.parse(part.getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
} catch(XmlException e) { | |||
throw new IOException(e.getLocalizedMessage(), e); | |||
} |
@@ -17,6 +17,7 @@ | |||
package org.apache.poi.xssf.usermodel; | |||
import org.apache.poi.POIXMLDocumentPart; | |||
import org.apache.poi.POIXMLException; | |||
import org.apache.poi.ss.usermodel.BorderStyle; | |||
import org.apache.poi.ss.usermodel.CellStyle; | |||
@@ -153,12 +154,12 @@ public class XSSFCellStyle implements CellStyle { | |||
// Create a new Xf with the same contents | |||
_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 | |||
CTFill fill = CTFill.Factory.parse( | |||
src.getCTFill().toString() | |||
src.getCTFill().toString(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS | |||
); | |||
addFill(fill); | |||
@@ -177,7 +178,7 @@ public class XSSFCellStyle implements CellStyle { | |||
// Copy the font | |||
try { | |||
CTFont ctFont = CTFont.Factory.parse( | |||
src.getFont().getCTFont().toString() | |||
src.getFont().getCTFont().toString(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS | |||
); | |||
XSSFFont font = new XSSFFont(ctFont); | |||
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.ChartAxisFactory; | |||
import org.apache.poi.ss.usermodel.charts.ChartData; | |||
import org.apache.poi.util.DocumentHelper; | |||
import org.apache.poi.util.Internal; | |||
import org.apache.poi.xssf.usermodel.charts.XSSFCategoryAxis; | |||
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 { | |||
super(part, rel); | |||
chartSpace = ChartSpaceDocument.Factory.parse(part.getInputStream()).getChartSpace(); | |||
chartSpace = ChartSpaceDocument.Factory.parse(part.getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS).getChartSpace(); | |||
chart = chartSpace.getChart(); | |||
} | |||
@@ -27,6 +27,7 @@ import java.util.Map; | |||
import javax.xml.namespace.QName; | |||
import org.apache.poi.POIXMLDocumentPart; | |||
import org.apache.poi.POIXMLException; | |||
import org.apache.poi.openxml4j.opc.PackagePart; | |||
import org.apache.poi.openxml4j.opc.PackageRelationship; | |||
@@ -61,7 +62,7 @@ public class XSSFChartSheet extends XSSFSheet { | |||
super.read(new ByteArrayInputStream(BLANK_WORKSHEET)); | |||
try { | |||
chartsheet = ChartsheetDocument.Factory.parse(is).getChartsheet(); | |||
chartsheet = ChartsheetDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS).getChartsheet(); | |||
} catch (XmlException 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.SheetUtil; | |||
import org.apache.poi.util.Beta; | |||
import org.apache.poi.util.DocumentHelper; | |||
import org.apache.poi.util.Internal; | |||
import org.apache.poi.util.POILogFactory; | |||
import org.apache.poi.util.POILogger; | |||
@@ -193,7 +194,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet { | |||
protected void read(InputStream is) throws IOException { | |||
try { | |||
worksheet = WorksheetDocument.Factory.parse(is).getWorksheet(); | |||
worksheet = WorksheetDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS).getWorksheet(); | |||
} catch (XmlException 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.PackageRelationship; | |||
import org.apache.poi.ss.util.CellReference; | |||
import org.apache.poi.util.DocumentHelper; | |||
import org.apache.poi.xssf.usermodel.helpers.XSSFXmlColumnPr; | |||
import org.apache.xmlbeans.XmlException; | |||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTable; | |||
@@ -69,7 +70,7 @@ public class XSSFTable extends POIXMLDocumentPart { | |||
public void readFrom(InputStream is) throws IOException { | |||
try { | |||
TableDocument doc = TableDocument.Factory.parse(is); | |||
TableDocument doc = TableDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
ctTable = doc.getTable(); | |||
} catch (XmlException e) { | |||
throw new IOException(e.getLocalizedMessage()); |
@@ -20,6 +20,7 @@ package org.apache.poi.xssf.usermodel; | |||
import org.apache.poi.POIXMLDocumentPart; | |||
import org.apache.poi.openxml4j.opc.PackagePart; | |||
import org.apache.poi.openxml4j.opc.PackageRelationship; | |||
import org.apache.poi.util.DocumentHelper; | |||
import org.apache.poi.xssf.util.EvilUnclosedBRFixingInputStream; | |||
import org.apache.xmlbeans.XmlException; | |||
import org.apache.xmlbeans.XmlOptions; | |||
@@ -106,7 +107,7 @@ public final class XSSFVMLDrawing extends POIXMLDocumentPart { | |||
protected void read(InputStream is) throws IOException, XmlException { | |||
XmlObject root = XmlObject.Factory.parse( | |||
new EvilUnclosedBRFixingInputStream(is) | |||
new EvilUnclosedBRFixingInputStream(is), POIXMLDocumentPart.DEFAULT_XML_OPTIONS | |||
); | |||
_qnames = new ArrayList<QName>(); | |||
@@ -115,13 +116,13 @@ public final class XSSFVMLDrawing extends POIXMLDocumentPart { | |||
Node nd = obj.getDomNode(); | |||
QName qname = new QName(nd.getNamespaceURI(), nd.getLocalName()); | |||
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)) { | |||
CTShapetype st = CTShapetype.Factory.parse(obj.xmlText()); | |||
CTShapetype st = CTShapetype.Factory.parse(obj.xmlText(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
_items.add(st); | |||
_shapeTypeId = st.getId(); | |||
} 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(); | |||
if(id != null) { | |||
Matcher m = ptrn_shapeId.matcher(id); | |||
@@ -129,7 +130,7 @@ public final class XSSFVMLDrawing extends POIXMLDocumentPart { | |||
} | |||
_items.add(shape); | |||
} else { | |||
_items.add(XmlObject.Factory.parse(obj.xmlText())); | |||
_items.add(XmlObject.Factory.parse(obj.xmlText(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS)); | |||
} | |||
_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.WorkbookUtil; | |||
import org.apache.poi.util.Beta; | |||
import org.apache.poi.util.DocumentHelper; | |||
import org.apache.poi.util.IOUtils; | |||
import org.apache.poi.util.Internal; | |||
import org.apache.poi.util.POILogFactory; | |||
@@ -333,7 +334,7 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook { | |||
@SuppressWarnings("deprecation") // getXYZArray() array accessors are deprecated | |||
protected void onDocumentRead() throws IOException { | |||
try { | |||
WorkbookDocument doc = WorkbookDocument.Factory.parse(getPackagePart().getInputStream()); | |||
WorkbookDocument doc = WorkbookDocument.Factory.parse(getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
this.workbook = doc.getWorkbook(); | |||
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.TargetMode; | |||
import org.apache.poi.poifs.crypt.HashAlgorithm; | |||
import org.apache.poi.util.DocumentHelper; | |||
import org.apache.poi.util.IOUtils; | |||
import org.apache.poi.util.IdentifierManager; | |||
import org.apache.poi.util.Internal; | |||
@@ -155,7 +156,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody { | |||
@Override | |||
protected void onDocumentRead() throws IOException { | |||
try { | |||
DocumentDocument doc = DocumentDocument.Factory.parse(getPackagePart().getInputStream()); | |||
DocumentDocument doc = DocumentDocument.Factory.parse(getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
ctDocument = doc.getDocument(); | |||
initFootnotes(); | |||
@@ -205,7 +206,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody { | |||
header.onDocumentRead(); | |||
} else if (relation.equals(XWPFRelation.COMMENT.getRelation())) { | |||
// 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()) { | |||
comments.add(new XWPFComment(ctcomment, this)); | |||
} | |||
@@ -262,7 +263,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody { | |||
this.footnotes = (XWPFFootnotes) p; | |||
this.footnotes.onDocumentRead(); | |||
} 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()) { | |||
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); | |||
} | |||
StylesDocument sd = StylesDocument.Factory.parse(parts[0].getInputStream()); | |||
StylesDocument sd = StylesDocument.Factory.parse(parts[0].getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
return sd.getStyles(); | |||
} | |||
@@ -28,6 +28,7 @@ import org.apache.poi.POIXMLDocumentPart; | |||
import org.apache.poi.POIXMLException; | |||
import org.apache.poi.openxml4j.opc.PackagePart; | |||
import org.apache.poi.openxml4j.opc.PackageRelationship; | |||
import org.apache.poi.util.DocumentHelper; | |||
import org.apache.xmlbeans.XmlCursor; | |||
import org.apache.xmlbeans.XmlObject; | |||
import org.apache.xmlbeans.XmlOptions; | |||
@@ -102,7 +103,7 @@ public class XWPFFooter extends XWPFHeaderFooter { | |||
InputStream is; | |||
try { | |||
is = getPackagePart().getInputStream(); | |||
ftrDocument = FtrDocument.Factory.parse(is); | |||
ftrDocument = FtrDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
headerFooter = ftrDocument.getFtr(); | |||
// parse the document with cursor and add | |||
// the XmlObject to its lists |
@@ -31,7 +31,8 @@ import org.apache.poi.POIXMLDocumentPart; | |||
import org.apache.poi.POIXMLException; | |||
import org.apache.poi.openxml4j.exceptions.OpenXML4JException; | |||
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.XmlOptions; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFootnotes; | |||
@@ -71,7 +72,7 @@ public class XWPFFootnotes extends POIXMLDocumentPart { | |||
FootnotesDocument notesDoc; | |||
try { | |||
InputStream is = getPackagePart().getInputStream(); | |||
notesDoc = FootnotesDocument.Factory.parse(is); | |||
notesDoc = FootnotesDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
ctFootnotes = notesDoc.getFootnotes(); | |||
} catch (XmlException e) { | |||
throw new POIXMLException(); |
@@ -28,6 +28,7 @@ import org.apache.poi.POIXMLDocumentPart; | |||
import org.apache.poi.POIXMLException; | |||
import org.apache.poi.openxml4j.opc.PackagePart; | |||
import org.apache.poi.openxml4j.opc.PackageRelationship; | |||
import org.apache.poi.util.DocumentHelper; | |||
import org.apache.xmlbeans.XmlCursor; | |||
import org.apache.xmlbeans.XmlException; | |||
import org.apache.xmlbeans.XmlObject; | |||
@@ -105,7 +106,7 @@ public class XWPFHeader extends XWPFHeaderFooter { | |||
InputStream is; | |||
try { | |||
is = getPackagePart().getInputStream(); | |||
hdrDocument = HdrDocument.Factory.parse(is); | |||
hdrDocument = HdrDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
headerFooter = hdrDocument.getHdr(); | |||
// parse the document with cursor and add | |||
// 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.opc.PackagePart; | |||
import org.apache.poi.openxml4j.opc.PackageRelationship; | |||
import org.apache.poi.util.DocumentHelper; | |||
import org.apache.xmlbeans.XmlException; | |||
import org.apache.xmlbeans.XmlOptions; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTAbstractNum; | |||
@@ -75,7 +76,7 @@ public class XWPFNumbering extends POIXMLDocumentPart { | |||
InputStream is; | |||
is = getPackagePart().getInputStream(); | |||
try { | |||
numberingDoc = NumberingDocument.Factory.parse(is); | |||
numberingDoc = NumberingDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
ctNumbering = numberingDoc.getNumbering(); | |||
//get any Nums | |||
for (CTNum ctNum : ctNumbering.getNumArray()) { |
@@ -25,6 +25,7 @@ import java.util.List; | |||
import javax.xml.namespace.QName; | |||
import org.apache.poi.POIXMLDocumentPart; | |||
import org.apache.poi.POIXMLException; | |||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException; | |||
import org.apache.poi.util.Internal; | |||
@@ -32,50 +33,50 @@ import org.apache.poi.wp.usermodel.CharacterRun; | |||
import org.apache.xmlbeans.XmlCursor; | |||
import org.apache.xmlbeans.XmlException; | |||
import org.apache.xmlbeans.XmlObject; | |||
import org.apache.xmlbeans.XmlString; | |||
import org.apache.xmlbeans.XmlToken; | |||
import org.apache.xmlbeans.impl.values.XmlAnyTypeImpl; | |||
import org.openxmlformats.schemas.drawingml.x2006.main.CTBlip; | |||
import org.openxmlformats.schemas.drawingml.x2006.main.CTBlipFillProperties; | |||
import org.openxmlformats.schemas.drawingml.x2006.main.CTGraphicalObject; | |||
import org.openxmlformats.schemas.drawingml.x2006.main.CTGraphicalObjectData; | |||
import org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps; | |||
import org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualPictureProperties; | |||
import org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D; | |||
import org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D; | |||
import org.openxmlformats.schemas.drawingml.x2006.main.CTPresetGeometry2D; | |||
import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties; | |||
import org.openxmlformats.schemas.drawingml.x2006.main.CTTransform2D; | |||
import org.openxmlformats.schemas.drawingml.x2006.main.STShapeType; | |||
import org.openxmlformats.schemas.drawingml.x2006.picture.CTPicture; | |||
import org.openxmlformats.schemas.drawingml.x2006.picture.CTPictureNonVisual; | |||
import org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.CTAnchor; | |||
import org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.CTInline; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBr; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTColor; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDrawing; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTEmpty; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFFCheckBox; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFldChar; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFonts; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdnRef; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHpsMeasure; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPTab; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSignedHpsMeasure; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSignedTwipsMeasure; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTText; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTUnderline; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTVerticalAlignRun; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STBrClear; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STBrType; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STFldCharType; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STOnOff; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STUnderline; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STVerticalAlignRun; | |||
import org.w3c.dom.NodeList; | |||
import org.apache.xmlbeans.XmlString; | |||
import org.apache.xmlbeans.XmlToken; | |||
import org.apache.xmlbeans.impl.values.XmlAnyTypeImpl; | |||
import org.openxmlformats.schemas.drawingml.x2006.main.CTBlip; | |||
import org.openxmlformats.schemas.drawingml.x2006.main.CTBlipFillProperties; | |||
import org.openxmlformats.schemas.drawingml.x2006.main.CTGraphicalObject; | |||
import org.openxmlformats.schemas.drawingml.x2006.main.CTGraphicalObjectData; | |||
import org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps; | |||
import org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualPictureProperties; | |||
import org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D; | |||
import org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D; | |||
import org.openxmlformats.schemas.drawingml.x2006.main.CTPresetGeometry2D; | |||
import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties; | |||
import org.openxmlformats.schemas.drawingml.x2006.main.CTTransform2D; | |||
import org.openxmlformats.schemas.drawingml.x2006.main.STShapeType; | |||
import org.openxmlformats.schemas.drawingml.x2006.picture.CTPicture; | |||
import org.openxmlformats.schemas.drawingml.x2006.picture.CTPictureNonVisual; | |||
import org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.CTAnchor; | |||
import org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.CTInline; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBr; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTColor; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDrawing; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTEmpty; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFFCheckBox; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFldChar; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFonts; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdnRef; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHpsMeasure; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPTab; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSignedHpsMeasure; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSignedTwipsMeasure; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTText; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTUnderline; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTVerticalAlignRun; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STBrClear; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STBrType; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STFldCharType; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STOnOff; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STUnderline; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STVerticalAlignRun; | |||
import org.w3c.dom.NodeList; | |||
import org.w3c.dom.Text; | |||
/** | |||
@@ -175,7 +176,7 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun { | |||
if (pict instanceof XmlAnyTypeImpl) { | |||
// Pesky XmlBeans bug - see Bugzilla #49934 | |||
try { | |||
pict = CTPicture.Factory.parse(pict.toString()); | |||
pict = CTPicture.Factory.parse(pict.toString(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
} catch (XmlException e) { | |||
throw new POIXMLException(e); | |||
} | |||
@@ -945,7 +946,7 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun { | |||
"<pic:pic xmlns:pic=\"" + CTPicture.type.getName().getNamespaceURI() + "\" />" + | |||
"</a:graphicData>" + | |||
"</a:graphic>"; | |||
inline.set(XmlToken.Factory.parse(xml)); | |||
inline.set(XmlToken.Factory.parse(xml, POIXMLDocumentPart.DEFAULT_XML_OPTIONS)); | |||
// Setup the inline | |||
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.poifs.crypt.CryptoFunctions; | |||
import org.apache.poi.poifs.crypt.HashAlgorithm; | |||
import org.apache.poi.util.DocumentHelper; | |||
import org.apache.xmlbeans.XmlOptions; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDocProtect; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff; | |||
@@ -403,7 +404,7 @@ public class XWPFSettings extends POIXMLDocumentPart { | |||
private void readFrom(InputStream inputStream) { | |||
try { | |||
ctSettings = SettingsDocument.Factory.parse(inputStream).getSettings(); | |||
ctSettings = SettingsDocument.Factory.parse(inputStream, POIXMLDocumentPart.DEFAULT_XML_OPTIONS).getSettings(); | |||
} catch (Exception e) { | |||
throw new RuntimeException(e); | |||
} |
@@ -31,7 +31,8 @@ import org.apache.poi.POIXMLDocumentPart; | |||
import org.apache.poi.POIXMLException; | |||
import org.apache.poi.openxml4j.exceptions.OpenXML4JException; | |||
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.XmlOptions; | |||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDocDefaults; | |||
@@ -82,7 +83,7 @@ public class XWPFStyles extends POIXMLDocumentPart { | |||
StylesDocument stylesDoc; | |||
try { | |||
InputStream is = getPackagePart().getInputStream(); | |||
stylesDoc = StylesDocument.Factory.parse(is); | |||
stylesDoc = StylesDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS); | |||
setStyles(stylesDoc.getStyles()); | |||
latentStyles = new XWPFLatentStyles(ctStyles.getLatentStyles(), this); | |||
} catch (XmlException e) { |