]> source.dussan.org Git - poi.git/commitdiff
Use the default XmlOptions for all the invocations of the XmlBeans XML parsing
authorDominik Stadler <centic@apache.org>
Sat, 17 Oct 2015 08:45:25 +0000 (08:45 +0000)
committerDominik Stadler <centic@apache.org>
Sat, 17 Oct 2015 08:45:25 +0000 (08:45 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1709128 13f79535-47bb-0310-9956-ffa450edef68

48 files changed:
src/ooxml/java/org/apache/poi/POIXMLDocumentPart.java
src/ooxml/java/org/apache/poi/POIXMLProperties.java
src/ooxml/java/org/apache/poi/poifs/crypt/agile/AgileEncryptionInfoBuilder.java
src/ooxml/java/org/apache/poi/poifs/crypt/dsig/SignatureInfo.java
src/ooxml/java/org/apache/poi/poifs/crypt/dsig/facets/Office2010SignatureFacet.java
src/ooxml/java/org/apache/poi/poifs/crypt/dsig/facets/XAdESXLSignatureFacet.java
src/ooxml/java/org/apache/poi/poifs/crypt/dsig/services/RelationshipTransformService.java
src/ooxml/java/org/apache/poi/util/DocumentHelper.java
src/ooxml/java/org/apache/poi/util/XmlSort.java
src/ooxml/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java
src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFChart.java
src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFCommentAuthors.java
src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFComments.java
src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFCommonSlideData.java
src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFNotes.java
src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFNotesMaster.java
src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlide.java
src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideLayout.java
src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideMaster.java
src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideShow.java
src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java
src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableStyles.java
src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTheme.java
src/ooxml/java/org/apache/poi/xssf/dev/XSSFDump.java
src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFReader.java
src/ooxml/java/org/apache/poi/xssf/model/CalculationChain.java
src/ooxml/java/org/apache/poi/xssf/model/CommentsTable.java
src/ooxml/java/org/apache/poi/xssf/model/ExternalLinksTable.java
src/ooxml/java/org/apache/poi/xssf/model/MapInfo.java
src/ooxml/java/org/apache/poi/xssf/model/SharedStringsTable.java
src/ooxml/java/org/apache/poi/xssf/model/SingleXmlCells.java
src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java
src/ooxml/java/org/apache/poi/xssf/model/ThemesTable.java
src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java
src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFChart.java
src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFChartSheet.java
src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFTable.java
src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFVMLDrawing.java
src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java
src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFFooter.java
src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFFootnotes.java
src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFHeader.java
src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFNumbering.java
src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFRun.java
src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFSettings.java
src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFStyles.java

index 857f0dad23c29c81a7373bf903f7114ff36c16b0..21228f49f68dde1cc59c85a9b9ca9d19c58a9989 100644 (file)
@@ -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;
index 27c1c49d11e2584070726c458705fe4fe911814a..e6f68691e98f7cf48ea06165604f55552972a3d4 100644 (file)
@@ -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 {
index b778c1032a2eedd4fba2e4187eac95edcebb90f8..37447cea51cd49943df9930aca6b0eb713f54147 100644 (file)
@@ -20,6 +20,7 @@ import java.io.IOException;
 import java.io.InputStream;\r
 \r
 import org.apache.poi.EncryptedDocumentException;\r
+import org.apache.poi.POIXMLDocumentPart;\r
 import org.apache.poi.poifs.crypt.ChainingMode;\r
 import org.apache.poi.poifs.crypt.CipherAlgorithm;\r
 import org.apache.poi.poifs.crypt.EncryptionInfo;\r
@@ -111,7 +112,7 @@ public class AgileEncryptionInfoBuilder implements EncryptionInfoBuilder {
     \r
     protected static EncryptionDocument parseDescriptor(String descriptor) {\r
         try {\r
-            return EncryptionDocument.Factory.parse(descriptor);\r
+            return EncryptionDocument.Factory.parse(descriptor, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);\r
         } catch (XmlException e) {\r
             throw new EncryptedDocumentException("Unable to parse encryption descriptor", e);\r
         }\r
@@ -119,7 +120,7 @@ public class AgileEncryptionInfoBuilder implements EncryptionInfoBuilder {
 \r
     protected static EncryptionDocument parseDescriptor(InputStream descriptor) {\r
         try {\r
-            return EncryptionDocument.Factory.parse(descriptor);\r
+            return EncryptionDocument.Factory.parse(descriptor, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);\r
         } catch (Exception e) {\r
             throw new EncryptedDocumentException("Unable to parse encryption descriptor", e);\r
         }\r
index c6efe6077d72970b749b0d537d2da644c23c9698..9526c968b852008531aceae16cd018f272189277 100644 (file)
@@ -68,6 +68,7 @@ import javax.xml.xpath.XPathFactory;
 import org.apache.jcp.xml.dsig.internal.dom.DOMReference;\r
 import org.apache.jcp.xml.dsig.internal.dom.DOMSignedInfo;\r
 import org.apache.poi.EncryptedDocumentException;\r
+import org.apache.poi.POIXMLDocumentPart;\r
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;\r
 import org.apache.poi.openxml4j.opc.ContentTypes;\r
 import org.apache.poi.openxml4j.opc.OPCPackage;\r
@@ -212,7 +213,7 @@ public class SignatureInfo implements SignatureConfigurable {
          */\r
         public SignatureDocument getSignatureDocument() throws IOException, XmlException {\r
             // TODO: check for XXE\r
-            return SignatureDocument.Factory.parse(signaturePart.getInputStream());\r
+            return SignatureDocument.Factory.parse(signaturePart.getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);\r
         }\r
         \r
         /**\r
@@ -630,7 +631,7 @@ public class SignatureInfo implements SignatureConfigurable {
         \r
         try {\r
             OutputStream os = sigPart.getOutputStream();\r
-            SignatureDocument sigDoc = SignatureDocument.Factory.parse(document);\r
+            SignatureDocument sigDoc = SignatureDocument.Factory.parse(document, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);\r
             sigDoc.save(os, xo);\r
             os.close();\r
         } catch (Exception e) {\r
index 3ea2e27afb6a58647e5bc2581d252403da401c11..de12275c40372a16396620d5733ae9ab5212bffe 100644 (file)
@@ -26,6 +26,7 @@ package org.apache.poi.poifs.crypt.dsig.facets;
 \r
 import javax.xml.crypto.MarshalException;\r
 \r
+import org.apache.poi.POIXMLDocumentPart;\r
 import org.apache.xmlbeans.XmlException;\r
 import org.etsi.uri.x01903.v13.QualifyingPropertiesType;\r
 import org.etsi.uri.x01903.v13.UnsignedPropertiesType;\r
@@ -56,7 +57,7 @@ public class Office2010SignatureFacet extends SignatureFacet {
 \r
         QualifyingPropertiesType qualProps;\r
         try {\r
-            qualProps = QualifyingPropertiesType.Factory.parse(nl.item(0));\r
+            qualProps = QualifyingPropertiesType.Factory.parse(nl.item(0), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);\r
         } catch (XmlException e) {\r
             throw new MarshalException(e);\r
         }\r
index 493afb843b4a020e0baac8d3ae1753c9635ba3b4..2427f09fd19e805887928fd5dde7ae46059588b6 100644 (file)
@@ -46,6 +46,7 @@ import java.util.UUID;
 \r
 import javax.xml.crypto.MarshalException;\r
 \r
+import org.apache.poi.POIXMLDocumentPart;\r
 import org.apache.poi.poifs.crypt.dsig.services.RevocationData;\r
 import org.apache.poi.util.POILogFactory;\r
 import org.apache.poi.util.POILogger;\r
@@ -128,7 +129,7 @@ public class XAdESXLSignatureFacet extends SignatureFacet {
         NodeList qualNl = document.getElementsByTagNameNS(XADES_132_NS, "QualifyingProperties");\r
         if (qualNl.getLength() == 1) {\r
             try {\r
-                qualDoc = QualifyingPropertiesDocument.Factory.parse(qualNl.item(0));\r
+                qualDoc = QualifyingPropertiesDocument.Factory.parse(qualNl.item(0), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);\r
             } catch (XmlException e) {\r
                 throw new MarshalException(e);\r
             }\r
index dea586463b870abc2e3f7cefa826f55473c283e3..656672d5090a908ab09e9b96d0512eb75451653f 100644 (file)
@@ -48,6 +48,7 @@ import javax.xml.crypto.dsig.TransformException;
 import javax.xml.crypto.dsig.TransformService;\r
 import javax.xml.crypto.dsig.spec.TransformParameterSpec;\r
 \r
+import org.apache.poi.POIXMLDocumentPart;\r
 import org.apache.poi.util.POILogFactory;\r
 import org.apache.poi.util.POILogger;\r
 import org.apache.poi.util.XmlSort;\r
@@ -141,7 +142,7 @@ public class RelationshipTransformService extends TransformService {
         Node parentNode = domParent.getNode();\r
         \r
         try {\r
-            TransformDocument transDoc = TransformDocument.Factory.parse(parentNode);\r
+            TransformDocument transDoc = TransformDocument.Factory.parse(parentNode, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);\r
             XmlObject xoList[] = transDoc.getTransform().selectChildren(RelationshipReferenceDocument.type.getDocumentElementName());\r
             if (xoList.length == 0) {\r
                 LOG.log(POILogger.WARN, "no RelationshipReference/@SourceId parameters present");\r
@@ -187,7 +188,7 @@ public class RelationshipTransformService extends TransformService {
         \r
         RelationshipsDocument relDoc;\r
         try {\r
-            relDoc = RelationshipsDocument.Factory.parse(octetStream);\r
+            relDoc = RelationshipsDocument.Factory.parse(octetStream, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);\r
         } catch (Exception e) {\r
             throw new TransformException(e.getMessage(), e);\r
         }\r
index ac98b44550cd0f635cd4b7ad4233ca87aabc3322..492e549142b3e6f0b543422bef1acb98456bb0b7 100644 (file)
@@ -33,7 +33,7 @@ import org.xml.sax.SAXException;
 
 public final class DocumentHelper {
     private static POILogger logger = POILogFactory.getLogger(DocumentHelper.class);
-    
+
     private DocumentHelper() {}
 
     /**
index 1a88b0930054b998c39bf5775e6842e34e0af2d3..93ff71d6924c30b40e6c5769e7f3b2175ab73e79 100644 (file)
@@ -23,6 +23,7 @@ import java.util.Comparator;
 \r
 import javax.xml.namespace.QName;\r
 \r
+import org.apache.poi.POIXMLDocumentPart;\r
 import org.apache.xmlbeans.XmlCursor;\r
 import org.apache.xmlbeans.XmlException;\r
 import org.apache.xmlbeans.XmlObject;\r
@@ -49,7 +50,7 @@ public final class XmlSort
         File f = new File(args[0]);\r
         try\r
         {\r
-            XmlObject docInstance = XmlObject.Factory.parse(f);\r
+            XmlObject docInstance = XmlObject.Factory.parse(f, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);\r
             XmlObject element = null;\r
             if (args.length > 1)\r
             {\r
index f61d743a19babff6d63a7ead1ab5efeb5b7f62b9..e896420e9302c9c18a2a5e69d424f141bbf666b7 100644 (file)
@@ -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>();
index 702d54427da70d96d723dc6405b3f944d1a5c0f7..5ded5a7aedc576e506fc0460a17de6429cbfebd9 100644 (file)
@@ -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();
        }
 
index e52b9ec6511f2e55af7c110fcf0a9fe48c34e4c4..4274ba7847cbb7303f754e3f4e1f218eb88b0959 100644 (file)
@@ -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();
     }
     
index df3ca7ad05d082947109a7bae651df3396718b4a..16190c64c861595f58c2c36fdb3943d59f8699a2 100644 (file)
@@ -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();
     }
     
index 0033665aa5f7ee794c825f09a73f193962cc3085..7f87f6d695051611b415dfe4b8aa41890157507e 100644 (file)
@@ -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);
                     }
index 0acb411fc2bfa202cc1ea328aa199f855c20ca7c..22b1607ddae11db28ef852b4fba42c6492b2d4a4 100644 (file)
@@ -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());
     }
index 5da683ce56bc3b0455ffb2ab773e4549224b1734..b3d1777ac5996c487014bcf9846009f330119172 100644 (file)
@@ -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 {
index cb66f697f05cd324d17f6489ecb6df67adb4d18e..cba6f3e6149c74490e881ac6eea006671a3a88ff 100644 (file)
@@ -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());
     }
index 48c5b20358d419abdd1d9c9f101da0b25fbb6bad..c72819708389a597d62b53db2959ebb148d377e0 100644 (file)
@@ -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());
     }
index e16b48031bcc3e2d58c951bbd27064053076ee5d..e6f37386b0cbe8fb4708a9aef6113b12abfbec1b 100644 (file)
@@ -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());
     }
index 79a5bd6d7546a1002daa57f276f870c333a55ce0..2646316415c23ba74048cff0a72ea1011a6b3900 100644 (file)
@@ -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);
index 3f156316676d282f6b6952eb7c35bda1bbc6abd1..7469e25d42de72cf54afcd9975562d4cd827f8ed 100644 (file)
@@ -26,6 +26,7 @@ import java.util.List;
 \r
 import javax.xml.namespace.QName;\r
 \r
+import org.apache.poi.POIXMLDocumentPart;\r
 import org.apache.poi.POIXMLException;\r
 import org.apache.poi.sl.usermodel.TableShape;\r
 import org.apache.poi.util.Internal;\r
@@ -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\r
         if(rs[0] instanceof XmlAnyTypeImpl){\r
             try {\r
-                rs[0] = CTTable.Factory.parse(rs[0].toString());\r
+                rs[0] = CTTable.Factory.parse(rs[0].toString(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);\r
             }catch (XmlException e){\r
                 throw new POIXMLException(e);\r
             }\r
index 245bbaae9da457c0a55617005081b4e57feae30a..86ae135344b3d8dc9b1c4b0d66f7c231cd496325 100644 (file)
@@ -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){
index 9c34ea55e3deadd8999ff940d932f6e9348f81a9..88b72602d9d97d34fd57c725149861d6cf738b9a 100644 (file)
@@ -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();
     }
index a3e04eb24ca846eecbe67d9d7dfb1b0d172de460..ecfcca717ba2b96c5de3de299c3576c9827970ee 100644 (file)
@@ -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);
index 7c250948c37f29999b8291ee1615ba351f03f944..172cf7a3b6913788ee1604432045ed67fb1f5376 100644 (file)
@@ -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);
index bcced82bca274eb75edb5d5cd78f4f612e5f56b3..855353732836abbf1e70b7dab97041d06ce80e7d 100644 (file)
@@ -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());
index 95bbf2907cd40e341e4cd7e18fad0ca299e4f255..b9ef88a9fa77f93e546af93ea75f4b74c58727d5 100644 (file)
@@ -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());
index c11d51ef9d3b25fe05a0a94e7df48fd34a767058..a96081ef3056699695995f8bbeb3dd624215729d 100644 (file)
@@ -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());
index 33c161b4c318198da1f36ebf407d2165559fc007..959df17b46fb32f5bea7eb2674507a2a3f91509b 100644 (file)
@@ -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>();
index 420eed7c15e3ab90d3549f9a7c9b8de70a08ae52..f88172b02338ac2514dc272c26f00580162a87ea 100644 (file)
@@ -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();
index cb1542e87be631a172c9224735ae8d19bef78598..effcde544f72e9320bdcff62f23715b21f9ac45c 100644 (file)
@@ -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());
index a119e457e440bb0f508025f8a65d98a784937b20..aec46b5aba308d527fd72c90b5050e62d95bc5eb 100644 (file)
@@ -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();
 
index 539cb1d90e501a4bf35325181ae912a37f5c1715..0873f07577fc5497d3d6af24aff966e1f20416ef 100644 (file)
@@ -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);
         }
index 918a7faf8e55e183b54c0c436ab9fe23f28fb2cb..37be56189179ffb413f90fc9ac7dbab433749c7e 100644 (file)
@@ -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);
index 0f2179a9dc5a1c72aca9dbe62b692f6b537504c2..a31d2e8c1e3027209175f5b37062246d57ec376e 100644 (file)
@@ -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();
        }
 
index 1b06370d8d5fab239b3fa837cd8a1f756bcc337f..5c8aae3c03da4a0134970e823be8cac5f28cf7d2 100644 (file)
@@ -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);
         }
index 728fedf86a8565d5cd509676f8f21af95fc42aed..d27a96e7ca39abf6b952da18b4bdc121e21aa8f7 100644 (file)
@@ -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);
         }
index d228cf9519e3466e63e3fd235c8dd0a8f0582cba..8cd1e10cdb1162cf832801f672c604ff6b0ee48d 100644 (file)
@@ -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());
index 75f292fa6352adaefe581c03e96db173363f2a0a..eb249f4148346877bc77bdc11ea2b0e7629d12eb 100644 (file)
@@ -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);
         }
index 0013580e48aa18d09a6af4b8076888b3c530810b..a9a277fc2fbd8921aa927ff1467984ae61496594 100644 (file)
@@ -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;
index be206d73985e091e6c1a870f2e8bb1e8031d2214..9855e2fda2325e4ceea3216ce2aa99ac84b8e720 100644 (file)
@@ -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();
     }
 
index 8ae33260f3673d7f688082b3d9708802d26c069e..eaf28e319e14b78b8a9dcb6cd6ac2127fd2c1374 100644 (file)
@@ -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
index c84cab66c6e95d9097fcc8a0c49780558812dc65..ecdf71d791c19ef5eaaf694999820dc6ac451c41 100644 (file)
@@ -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;\r
+import org.apache.poi.openxml4j.opc.PackageRelationship;
+import org.apache.poi.util.DocumentHelper;
 import org.apache.xmlbeans.XmlException;\r
 import org.apache.xmlbeans.XmlOptions;\r
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFootnotes;\r
@@ -71,7 +72,7 @@ public class XWPFFootnotes extends POIXMLDocumentPart {
         FootnotesDocument notesDoc;\r
         try {\r
             InputStream is = getPackagePart().getInputStream();\r
-            notesDoc = FootnotesDocument.Factory.parse(is);
+            notesDoc = FootnotesDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
             ctFootnotes = notesDoc.getFootnotes();
         } catch (XmlException e) {
             throw new POIXMLException();
index 2a31247fd0ab7df7c809e4d84c760ff96ac732ff..ccba7a00dab259d83379df7913ae15383f75dd8b 100644 (file)
@@ -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
index 842bb443468be872cd238a701132c3862539ddfb..a2f03de09f4dd7dc287d55b856cf033d5609f24f 100644 (file)
@@ -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;\r
         is = getPackagePart().getInputStream();\r
         try {\r
-            numberingDoc = NumberingDocument.Factory.parse(is);\r
+            numberingDoc = NumberingDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);\r
             ctNumbering = numberingDoc.getNumbering();\r
             //get any Nums\r
             for (CTNum ctNum : ctNumbering.getNumArray()) {\r
index b5e465dcb77e68862bc3a70b82214f46bc86fafd..5fb16060c16d7fb7eb90abf64a26c80b70dc5355 100644 (file)
@@ -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;\r
-import org.apache.xmlbeans.XmlToken;\r
-import org.apache.xmlbeans.impl.values.XmlAnyTypeImpl;\r
-import org.openxmlformats.schemas.drawingml.x2006.main.CTBlip;\r
-import org.openxmlformats.schemas.drawingml.x2006.main.CTBlipFillProperties;\r
-import org.openxmlformats.schemas.drawingml.x2006.main.CTGraphicalObject;\r
-import org.openxmlformats.schemas.drawingml.x2006.main.CTGraphicalObjectData;\r
-import org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps;\r
-import org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualPictureProperties;\r
-import org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D;\r
-import org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D;\r
-import org.openxmlformats.schemas.drawingml.x2006.main.CTPresetGeometry2D;\r
-import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties;\r
-import org.openxmlformats.schemas.drawingml.x2006.main.CTTransform2D;\r
-import org.openxmlformats.schemas.drawingml.x2006.main.STShapeType;\r
-import org.openxmlformats.schemas.drawingml.x2006.picture.CTPicture;\r
-import org.openxmlformats.schemas.drawingml.x2006.picture.CTPictureNonVisual;\r
-import org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.CTAnchor;\r
-import org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.CTInline;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBr;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTColor;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDrawing;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTEmpty;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFFCheckBox;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFldChar;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFonts;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdnRef;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHpsMeasure;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPTab;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSignedHpsMeasure;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSignedTwipsMeasure;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTText;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTUnderline;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTVerticalAlignRun;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.STBrClear;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.STBrType;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.STFldCharType;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.STOnOff;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.STUnderline;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.STVerticalAlignRun;\r
-import org.w3c.dom.NodeList;\r
+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;\r
 \r
 /**
@@ -175,7 +176,7 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun {
             if (pict instanceof XmlAnyTypeImpl) {\r
                 // Pesky XmlBeans bug - see Bugzilla #49934\r
                 try {\r
-                    pict = CTPicture.Factory.parse(pict.toString());\r
+                    pict = CTPicture.Factory.parse(pict.toString(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);\r
                 } catch (XmlException e) {\r
                     throw new POIXMLException(e);\r
                 }\r
@@ -945,7 +946,7 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun {
                             "<pic:pic xmlns:pic=\"" + CTPicture.type.getName().getNamespaceURI() + "\" />" +\r
                             "</a:graphicData>" +\r
                             "</a:graphic>";\r
-            inline.set(XmlToken.Factory.parse(xml));\r
+            inline.set(XmlToken.Factory.parse(xml, POIXMLDocumentPart.DEFAULT_XML_OPTIONS));\r
 \r
             // Setup the inline\r
             inline.setDistT(0);
index 30afbb9252381ec2419e698fcf487ba8124416f6..1dbc295875422183b1c7d7e0bc0131b82817797d 100644 (file)
@@ -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);
         }
index ed39601796afa4b67512934f7e48c992cd2d80ad..3be62b6717604c72da88bbcc40f47df94e287545 100644 (file)
@@ -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;\r
+import org.apache.poi.openxml4j.opc.PackageRelationship;
+import org.apache.poi.util.DocumentHelper;
 import org.apache.xmlbeans.XmlException;\r
 import org.apache.xmlbeans.XmlOptions;\r
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDocDefaults;\r
@@ -82,7 +83,7 @@ public class XWPFStyles extends POIXMLDocumentPart {
         StylesDocument stylesDoc;\r
         try {\r
             InputStream is = getPackagePart().getInputStream();\r
-            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) {