mirror of https://github.com/apache/poi.git
#58617 - Add custom safe XmlBeans type loader / rename vendor specific schema packages
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1715555 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
74d58c8bde
commit
01a6730ea7
1
.project
1
.project
|
@ -12,6 +12,7 @@
|
|||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.sonar.ide.eclipse.core.sonarNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
|
|
135
build.xml
135
build.xml
|
@ -206,8 +206,8 @@ under the License.
|
|||
<property name="ooxml.xsds.url.1"
|
||||
value="http://www.ecma-international.org/publications/files/ECMA-ST/Office%20Open%20XML%201st%20edition%20Part%204%20(PDF).zip"/>
|
||||
<property name="ooxml.xsds.src.dir" location="build/ooxml-xsds-src"/>
|
||||
<property name="ooxml.xsds.src.jar" location="${ooxml.lib}/ooxml-schemas-1.2-sources.jar"/>
|
||||
<property name="ooxml.xsds.jar" location="${ooxml.lib}/ooxml-schemas-1.2.jar"/>
|
||||
<property name="ooxml.xsds.src.jar" location="${ooxml.lib}/ooxml-schemas-1.3-sources.jar"/>
|
||||
<property name="ooxml.xsds.jar" location="${ooxml.lib}/ooxml-schemas-1.3.jar"/>
|
||||
|
||||
<!-- additional schemas are packed into the poi schemas jar, -->
|
||||
<!-- so we don't have to care about a seperate versioning of the original ooxml schemas -->
|
||||
|
@ -226,6 +226,8 @@ under the License.
|
|||
<property name="ooxml.security.jar" location="${ooxml.lib}/ooxml-security-1.0.jar"/>
|
||||
<property name="ooxml.security.xsd.dir" location="src/ooxml/resources/org/apache/poi/poifs/crypt"/>
|
||||
<property name="ooxml.visio.xsd.dir" location="src/ooxml/resources/org/apache/poi/xdgf"/>
|
||||
<property name="ooxml.schema.xsdconfig.dir" location="src/ooxml/resources/org/apache/poi/schemas"/>
|
||||
|
||||
|
||||
<property name="maven.ooxml.xsds.version.id" value="1.0"/>
|
||||
<property name="maven.ooxml.xsds.jar" value="ooxml-schemas-${maven.ooxml.xsds.version.id}.jar"/>
|
||||
|
@ -657,13 +659,14 @@ under the License.
|
|||
</or>
|
||||
</condition>
|
||||
</target>
|
||||
<target name="compile-ooxml-xsds" unless="ooxml-compiled-xsds.present"
|
||||
depends="init,check-compiled-ooxml-xsds"
|
||||
description="Unpacks the OOXML xsd files, and compiles them into XmlBeans">
|
||||
<taskdef name="xmlbean"
|
||||
classname="org.apache.xmlbeans.impl.tool.XMLBean"
|
||||
classpath="${ooxml.xmlbeans23.jar}"/>
|
||||
|
||||
<macrodef name="compile-ooxml-xmlbean">
|
||||
<attribute name="classes-jar"/>
|
||||
<attribute name="sources-jar"/>
|
||||
<attribute name="noupa" default="false"/>
|
||||
<attribute name="nopvr" default="false"/>
|
||||
<element name="xsds"/>
|
||||
<sequential>
|
||||
<!-- We need a fair amount of memory to compile the xml schema, -->
|
||||
<!-- but limit it in case it goes wrong! -->
|
||||
<!-- Pick the right amount based on 32 vs 64 bit jvm -->
|
||||
|
@ -671,63 +674,93 @@ under the License.
|
|||
<equals arg1="${sun.arch.data.model}" arg2="64" />
|
||||
</condition>
|
||||
|
||||
<property name="ooxml.xsds.tmp.dir" location="build/ooxml-xsds"/>
|
||||
<mkdir dir="${ooxml.xsds.tmp.dir}"/>
|
||||
<unzip src="${ooxml.lib}/${ooxml.xsds.izip.1}" dest="${ooxml.xsds.tmp.dir}"/>
|
||||
<copy todir="${ooxml.xsds.tmp.dir}">
|
||||
<fileset dir="${ooxml.visio.xsd.dir}"/>
|
||||
</copy>
|
||||
<xmlbean
|
||||
schema="${ooxml.xsds.tmp.dir}"
|
||||
srcgendir="${ooxml.xsds.src.dir}"
|
||||
optimize="yes"
|
||||
destfile="${ooxml.xsds.jar}"
|
||||
javasource="1.5"
|
||||
failonerror="true"
|
||||
fork="true"
|
||||
memoryMaximumSize="${ooxml.memory}"
|
||||
>
|
||||
<classpath refid="ooxml.classpath"/>
|
||||
</xmlbean>
|
||||
<taskdef name="xmlbean"
|
||||
classname="org.apache.xmlbeans.impl.tool.XMLBean"
|
||||
classpath="${ooxml.xmlbeans23.jar}"/>
|
||||
|
||||
<!-- Now make a jar of the schema sources -->
|
||||
<jar
|
||||
basedir="${ooxml.xsds.src.dir}"
|
||||
destfile="${ooxml.xsds.src.jar}"
|
||||
/>
|
||||
<property name="xmlbean.xsds.dir" location="build/xmlbean-xsds"/>
|
||||
<property name="xmlbean.sources.dir" location="build/xmlbean-sources"/>
|
||||
<property name="xmlbean.classes.dir" location="build/xmlbean-classes"/>
|
||||
<delete dir="${xmlbean.xsds.dir}"/>
|
||||
<mkdir dir="${xmlbean.xsds.dir}"/>
|
||||
<delete dir="${xmlbean.sources.dir}"/>
|
||||
<mkdir dir="${xmlbean.sources.dir}"/>
|
||||
<delete dir="${xmlbean.classes.dir}"/>
|
||||
<mkdir dir="${xmlbean.classes.dir}"/>
|
||||
|
||||
<!-- Now do the same for the security schemas -->
|
||||
<property name="ooxml.enc.xsds.tmp.dir" location="build/ooxml-security-xsds"/>
|
||||
<mkdir dir="${ooxml.enc.xsds.tmp.dir}"/>
|
||||
<unzip src="${ooxml.lib}/${ooxml.xsds.izip.2}" dest="${ooxml.enc.xsds.tmp.dir}"/>
|
||||
|
||||
<copy todir="${ooxml.enc.xsds.tmp.dir}">
|
||||
<fileset dir="${ooxml.lib}" includes="dc*.xsd,xmldsig*.xsd,XAdES*.xsd"/>
|
||||
<fileset dir="${ooxml.security.xsd.dir}"/>
|
||||
<copy todir="${xmlbean.xsds.dir}">
|
||||
<xsds/>
|
||||
</copy>
|
||||
|
||||
<!-- noupa/nopvr is set because of the dublincore schemas -->
|
||||
<!-- https://issues.apache.org/jira/browse/XMLBEANS-340 -->
|
||||
<!-- javasource > 1.5 will not generate all array accessor -->
|
||||
<xmlbean
|
||||
schema="${ooxml.enc.xsds.tmp.dir}"
|
||||
srcgendir="${ooxml.security.src.dir}"
|
||||
optimize="yes"
|
||||
destfile="${ooxml.security.jar}"
|
||||
schema="${xmlbean.xsds.dir}"
|
||||
srcgendir="${xmlbean.sources.dir}"
|
||||
classgendir="${xmlbean.classes.dir}"
|
||||
destfile="${xmlbean.xsds.dir}.jar"
|
||||
srconly="true"
|
||||
javasource="1.5"
|
||||
failonerror="true"
|
||||
fork="true"
|
||||
memoryMaximumSize="${ooxml.memory}"
|
||||
noupa="true"
|
||||
nopvr="true"
|
||||
noupa="@{noupa}"
|
||||
nopvr="@{nopvr}"
|
||||
>
|
||||
<classpath refid="ooxml.classpath"/>
|
||||
</xmlbean>
|
||||
|
||||
<jar
|
||||
basedir="${ooxml.security.src.dir}"
|
||||
destfile="${ooxml.security.src.jar}"
|
||||
/>
|
||||
<replace dir="${xmlbean.sources.dir}" includes="**/*.java" excludes="**/impl/**">
|
||||
<replacetoken>org.apache.xmlbeans.XmlBeans.getContextTypeLoader()</replacetoken>
|
||||
<replacevalue>org.apache.poi.POIXMLTypeLoader</replacevalue>
|
||||
</replace>
|
||||
|
||||
<copy todir="${xmlbean.sources.dir}">
|
||||
<fileset dir="src/ooxml/java" includes="org/apache/poi/POIXMLTypeLoader.java"/>
|
||||
</copy>
|
||||
|
||||
<javac target="${jdk.version.class}"
|
||||
source="${jdk.version.source}"
|
||||
srcdir="${xmlbean.sources.dir}"
|
||||
destdir="${xmlbean.classes.dir}"
|
||||
encoding="${java.source.encoding}"
|
||||
fork="yes"
|
||||
optimize="true"
|
||||
memoryMaximumSize="${ooxml.memory}"
|
||||
includeantruntime="false">
|
||||
<!-- debug="${compile.debug}" -->
|
||||
<classpath refid="ooxml.classpath"/>
|
||||
</javac>
|
||||
|
||||
<jar basedir="${xmlbean.classes.dir}" destfile="@{classes-jar}" excludes="org/apache/**" level="9" />
|
||||
<jar basedir="${xmlbean.sources.dir}" destfile="@{sources-jar}" excludes="org/apache/**" level="9" />
|
||||
|
||||
<delete file="${xmlbean.xsds.dir}.jar"/>
|
||||
<delete dir="${xmlbean.xsds.dir}"/>
|
||||
<delete dir="${xmlbean.sources.dir}"/>
|
||||
<delete dir="${xmlbean.classes.dir}"/>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<target name="compile-ooxml-xsds" unless="ooxml-compiled-xsds.present"
|
||||
depends="init,check-compiled-ooxml-xsds"
|
||||
description="Unpacks the OOXML xsd files, and compiles them into XmlBeans">
|
||||
<compile-ooxml-xmlbean classes-jar="${ooxml.xsds.jar}" sources-jar="${ooxml.xsds.src.jar}">
|
||||
<xsds>
|
||||
<zipfileset src="${ooxml.lib}/${ooxml.xsds.izip.1}"/>
|
||||
<fileset dir="${ooxml.visio.xsd.dir}"/>
|
||||
<fileset dir="${ooxml.schema.xsdconfig.dir}"/>
|
||||
</xsds>
|
||||
</compile-ooxml-xmlbean>
|
||||
<!-- Now do the same for the security schemas -->
|
||||
<!-- noupa/nopvr is set because of the dublincore schemas -->
|
||||
<!-- https://issues.apache.org/jira/browse/XMLBEANS-340 -->
|
||||
<compile-ooxml-xmlbean classes-jar="${ooxml.security.jar}" sources-jar="${ooxml.security.src.jar}" noupa="true" nopvr="true">
|
||||
<xsds>
|
||||
<zipfileset src="${ooxml.lib}/${ooxml.xsds.izip.2}"/>
|
||||
<fileset dir="${ooxml.lib}" includes="dc*.xsd,xmldsig*.xsd,XAdES*.xsd"/>
|
||||
<fileset dir="${ooxml.security.xsd.dir}"/>
|
||||
</xsds>
|
||||
</compile-ooxml-xmlbean>
|
||||
</target>
|
||||
|
||||
<target name="compile" depends="init, compile-main,
|
||||
|
|
|
@ -7,11 +7,12 @@
|
|||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-parent</artifactId>
|
||||
<version>3.14-beta1-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>poi-ooxml-schema-encryption</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Apach POI - Openxmlformats Encryption Schema package</name>
|
||||
<name>Apache POI - Openxmlformats Encryption Schema package</name>
|
||||
|
||||
<properties>
|
||||
<!-- see http://docs.codehaus.org/display/SONAR/Narrowing+the+Focus for details of this property -->
|
||||
|
@ -21,28 +22,25 @@
|
|||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>xmlbeans-maven-plugin</artifactId>
|
||||
<version>2.3.3</version>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<version>1.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>unzip-schema</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>xmlbeans</goal>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<copy todir="target/schemas">
|
||||
<fileset dir="../../src/ooxml/resources/org/apache/poi/poifs/crypt" includes="encryption*.*"/>
|
||||
</copy>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<schemaDirectory>../../src/ooxml/resources/org/apache/poi/poifs/crypt</schemaDirectory>
|
||||
<sourceSchemas>
|
||||
<sourceSchema>encryptionInfo.xsd</sourceSchema>
|
||||
</sourceSchemas>
|
||||
<xmlConfigs>
|
||||
<xmlConfig implementation="java.io.File">../../src/ooxml/resources/org/apache/poi/poifs/crypt/encryptionInfo.xsdconfig</xmlConfig>
|
||||
</xmlConfigs>
|
||||
<javaSource>1.5</javaSource>
|
||||
<optimize>yes</optimize>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
|
|
@ -7,18 +7,20 @@
|
|||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-parent</artifactId>
|
||||
<version>3.14-beta1-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>poi-ooxml-schema-security</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Apach POI - Openxmlformats Security-Schema package</name>
|
||||
<name>Apache POI - Openxmlformats Security-Schema package</name>
|
||||
|
||||
<properties>
|
||||
<!-- see http://docs.codehaus.org/display/SONAR/Narrowing+the+Focus for details of this property -->
|
||||
<sonar.exclusions>target/generated-sources/*</sonar.exclusions>
|
||||
<maven.compiler.fork>true</maven.compiler.fork>
|
||||
<xmlbeans.noUpa>true</xmlbeans.noUpa>
|
||||
<xmlbeans.noPvr>true</xmlbeans.noPvr>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- Download and unpack the OfficeOpenXML Schema and use xmlbeans to create classes from the XSDs -->
|
||||
|
@ -104,6 +106,9 @@
|
|||
<execution>
|
||||
<id>unzip-schema</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<echo message="unzip schemas" />
|
||||
|
@ -112,34 +117,10 @@
|
|||
todir="target/schemas"/>
|
||||
</target>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>xmlbeans-maven-plugin</artifactId>
|
||||
<version>2.3.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>xmlbeans</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<schemaDirectory>target/schemas</schemaDirectory>
|
||||
<noUpa>true</noUpa>
|
||||
<noPvr>true</noPvr>
|
||||
<noJavac>true</noJavac>
|
||||
<javaSource>1.5</javaSource>
|
||||
<optimize>yes</optimize>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
|
|
@ -7,50 +7,20 @@
|
|||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-parent</artifactId>
|
||||
<version>3.14-beta1-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>poi-ooxml-schema</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Apach POI - Openxmlformats Schema package</name>
|
||||
<name>Apache POI - Openxmlformats Schema package</name>
|
||||
|
||||
<properties>
|
||||
<!-- see http://docs.codehaus.org/display/SONAR/Narrowing+the+Focus for details of this property -->
|
||||
<sonar.exclusions>target/generated-sources/*</sonar.exclusions>
|
||||
<maven.compiler.fork>true</maven.compiler.fork>
|
||||
<xmlbeans.xsdconfig>${basedir}/../../src/ooxml/resources/org/apache/poi/schemas/ooxmlSchemas.xsdconfig</xmlbeans.xsdconfig>
|
||||
</properties>
|
||||
|
||||
<profiles>
|
||||
<!-- We need a fair amount of memory to compile the xml schema, -->
|
||||
<!-- but limit it in case it goes wrong! -->
|
||||
<!-- Pick the right amount based on 32 vs 64 bit jvm -->
|
||||
|
||||
<profile>
|
||||
<id>32bitstuff</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>sun.arch.data.model</name>
|
||||
<value>32</value>
|
||||
</property>
|
||||
</activation>
|
||||
<properties>
|
||||
<maven.compiler.maxmem>512m</maven.compiler.maxmem>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>64bitstuff</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>sun.arch.data.model</name>
|
||||
<value>64</value>
|
||||
</property>
|
||||
</activation>
|
||||
<properties>
|
||||
<maven.compiler.maxmem>768m</maven.compiler.maxmem>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- Download and unpack the OfficeOpenXML Schema and use xmlbeans to create classes from the XSDs -->
|
||||
|
@ -60,7 +30,7 @@
|
|||
<version>1.1.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>install-xsds-part-4</id>
|
||||
<id>download-xsds</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>wget</goal>
|
||||
|
@ -85,7 +55,9 @@
|
|||
<configuration>
|
||||
<target>
|
||||
<echo message="unzip schemas" />
|
||||
<unzip src="target/OfficeOpenXML-XMLSchema.zip" dest="target/schemas/" />
|
||||
<unzip src="target/OfficeOpenXML-XMLSchema.zip" dest="target/schemas" />
|
||||
<copy file="../../src/ooxml/resources/org/apache/poi/xdgf/visio.xsd"
|
||||
todir="target/schemas"/>
|
||||
</target>
|
||||
</configuration>
|
||||
<goals>
|
||||
|
@ -94,49 +66,6 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- include the visio schema -->
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-sources</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>target/schemas/</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>../../src/ooxml/resources/org/apache/poi/xdgf/</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>xmlbeans-maven-plugin</artifactId>
|
||||
<version>2.3.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>xmlbeans</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<schemaDirectory>target/schemas</schemaDirectory>
|
||||
<javaSource>1.5</javaSource>
|
||||
<optimize>yes</optimize>
|
||||
<noJavac>true</noJavac>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
@ -151,7 +80,6 @@
|
|||
<artifactId>poi-scratchpad</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.xmlbeans</groupId>
|
||||
<artifactId>xmlbeans</artifactId>
|
||||
|
|
133
sonar/pom.xml
133
sonar/pom.xml
|
@ -1,16 +1,10 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
||||
http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-parent</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>3.14-beta1-SNAPSHOT</version>
|
||||
|
||||
<name>Apache POI - the Java API for Microsoft Documents</name>
|
||||
|
||||
<description>Maven build of Apache POI for Sonar checks</description>
|
||||
<url>http://poi.apache.org/</url>
|
||||
|
||||
|
@ -65,7 +59,6 @@
|
|||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>ASCII</project.build.sourceEncoding>
|
||||
|
||||
<!-- Try to disable running SVN blame as it causes errors here because the source is copied from the actual SVN location here! -->
|
||||
<sonar.scm.disabled>true</sonar.scm.disabled>
|
||||
</properties>
|
||||
|
@ -84,7 +77,6 @@
|
|||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
@ -97,7 +89,6 @@
|
|||
<version>2.16</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<configuration>
|
||||
<systemPropertyVariables>
|
||||
<POI.testdata.path>../../test-data</POI.testdata.path>
|
||||
|
@ -111,7 +102,6 @@
|
|||
<exclude>**/TestUnfixedBugs.java</exclude>
|
||||
<exclude>**/TestcaseRecordInputStream.java</exclude>
|
||||
<exclude>**/POITestCase.java</exclude>
|
||||
|
||||
<!-- TODO: error about no public construct, seems to run with JUnit 3.8... -->
|
||||
<exclude>**/TestWordToConverterSuite*.java</exclude>
|
||||
<exclude>**/TestExcelConverterSuite*.java</exclude>
|
||||
|
@ -132,4 +122,125 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
<!-- We need a fair amount of memory to compile the xml schema, -->
|
||||
<!-- but limit it in case it goes wrong! -->
|
||||
<!-- Pick the right amount based on 32 vs 64 bit jvm -->
|
||||
<profile>
|
||||
<id>32bitstuff</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>sun.arch.data.model</name>
|
||||
<value>32</value>
|
||||
</property>
|
||||
</activation>
|
||||
<properties>
|
||||
<maven.compiler.maxmem>512m</maven.compiler.maxmem>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>64bitstuff</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>sun.arch.data.model</name>
|
||||
<value>64</value>
|
||||
</property>
|
||||
</activation>
|
||||
<properties>
|
||||
<maven.compiler.maxmem>768m</maven.compiler.maxmem>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>xmlbean</id>
|
||||
<activation>
|
||||
<file><exists>xmlbeans.marker</exists></file>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>xmlbeans-maven-plugin</artifactId>
|
||||
<version>2.3.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>process-sources</phase>
|
||||
<goals>
|
||||
<goal>xmlbeans</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<schemaDirectory>${basedir}/target/schemas</schemaDirectory>
|
||||
<javaSource>1.5</javaSource>
|
||||
<noJavac>true</noJavac>
|
||||
<noUpa>${xmlbeans.noUpa}</noUpa>
|
||||
<noPvr>${xmlbeans.noPvr}</noPvr>
|
||||
<xmlConfigs>
|
||||
<xmlConfig implementation="java.io.File">${basedir}/../../src/ooxml/resources/org/apache/poi/poifs/crypt/encryptionCertificate.xsdconfig</xmlConfig>
|
||||
<xmlConfig implementation="java.io.File">${basedir}/../../src/ooxml/resources/org/apache/poi/poifs/crypt/encryptionInfo.xsdconfig</xmlConfig>
|
||||
<xmlConfig implementation="java.io.File">${basedir}/../../src/ooxml/resources/org/apache/poi/poifs/crypt/encryptionPassword.xsdconfig</xmlConfig>
|
||||
<xmlConfig implementation="java.io.File">${basedir}/../../src/ooxml/resources/org/apache/poi/schemas/ooxmlSchemas.xsdconfig</xmlConfig>
|
||||
</xmlConfigs>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<version>1.8</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-xmltype-and-xsdconfig</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals><goal>run</goal></goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<copy todir="${basedir}/target/generated-sources/xmlbeans">
|
||||
<fileset dir="${basedir}/../../src/ooxml/java" includes="org/apache/poi/POIXMLTypeLoader.java"/>
|
||||
</copy>
|
||||
<copy todir="${basedir}/target/schemas">
|
||||
<fileset dir="${basedir}/../../src/ooxml/resources/org/apache/poi/schemas"/>
|
||||
</copy>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>replace-xmltypeloader</id>
|
||||
<phase>process-sources</phase>
|
||||
<goals><goal>run</goal></goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<replace dir="${basedir}/target/generated-sources/xmlbeans" includes="**/*.java" excludes="**/impl/**">
|
||||
<replacetoken>org.apache.xmlbeans.XmlBeans.getContextTypeLoader()</replacetoken>
|
||||
<replacevalue>org.apache.poi.POIXMLTypeLoader</replacevalue>
|
||||
</replace>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>remove-xmltypeloader-from-schema-jar</id>
|
||||
<phase>prepare-package</phase>
|
||||
<goals><goal>run</goal></goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<touch file="${basedir}/target/generated-sources/xmlbeans/.staleFlag"/>
|
||||
<delete dir="${basedir}/target/classes/org/apache"/>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.xmlbeans</groupId>
|
||||
<artifactId>xmlbeans</artifactId>
|
||||
<version>2.6.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
|
|
|
@ -41,7 +41,6 @@ import org.apache.poi.openxml4j.opc.TargetMode;
|
|||
import org.apache.poi.util.Internal;
|
||||
import org.apache.poi.util.POILogFactory;
|
||||
import org.apache.poi.util.POILogger;
|
||||
import org.apache.xmlbeans.XmlOptions;
|
||||
|
||||
/**
|
||||
* Represents an entry of a OOXML package.
|
||||
|
@ -55,16 +54,6 @@ import org.apache.xmlbeans.XmlOptions;
|
|||
public class POIXMLDocumentPart {
|
||||
private static final POILogger logger = POILogFactory.getLogger(POIXMLDocumentPart.class);
|
||||
|
||||
public static final XmlOptions DEFAULT_XML_OPTIONS;
|
||||
static {
|
||||
DEFAULT_XML_OPTIONS = new XmlOptions();
|
||||
DEFAULT_XML_OPTIONS.setSaveOuter();
|
||||
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;
|
||||
private PackagePart packagePart;
|
||||
private PackageRelationship packageRel;
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
|
||||
|
@ -33,9 +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;
|
||||
|
||||
/**
|
||||
|
@ -74,7 +72,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(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS
|
||||
extPart.getInputStream(), DEFAULT_XML_OPTIONS
|
||||
);
|
||||
ext = new ExtendedProperties(props);
|
||||
} else {
|
||||
|
@ -88,7 +86,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(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS
|
||||
custPart.getInputStream(), DEFAULT_XML_OPTIONS
|
||||
);
|
||||
cust = new CustomProperties(props);
|
||||
} else {
|
||||
|
@ -142,28 +140,16 @@ public class POIXMLProperties {
|
|||
}
|
||||
}
|
||||
if(extPart != null){
|
||||
XmlOptions xmlOptions = new XmlOptions(POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", "vt");
|
||||
xmlOptions.setSaveSuggestedPrefixes(map);
|
||||
|
||||
OutputStream out = extPart.getOutputStream();
|
||||
if (extPart.getSize() > 0) {
|
||||
extPart.clear();
|
||||
}
|
||||
ext.props.save(out, xmlOptions);
|
||||
ext.props.save(out, DEFAULT_XML_OPTIONS);
|
||||
out.close();
|
||||
}
|
||||
if(custPart != null){
|
||||
XmlOptions xmlOptions = new XmlOptions(POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", "vt");
|
||||
xmlOptions.setSaveSuggestedPrefixes(map);
|
||||
|
||||
OutputStream out = custPart.getOutputStream();
|
||||
cust.props.save(out, xmlOptions);
|
||||
cust.props.save(out, DEFAULT_XML_OPTIONS);
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,119 @@
|
|||
/* ====================================================================
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
package org.apache.poi;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
import java.net.URL;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.stream.XMLStreamReader;
|
||||
|
||||
import org.apache.xmlbeans.SchemaType;
|
||||
import org.apache.xmlbeans.XmlBeans;
|
||||
import org.apache.xmlbeans.XmlException;
|
||||
import org.apache.xmlbeans.XmlObject;
|
||||
import org.apache.xmlbeans.XmlOptions;
|
||||
import org.apache.xmlbeans.xml.stream.XMLInputStream;
|
||||
import org.apache.xmlbeans.xml.stream.XMLStreamException;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class POIXMLTypeLoader {
|
||||
|
||||
public static final XmlOptions DEFAULT_XML_OPTIONS;
|
||||
static {
|
||||
DEFAULT_XML_OPTIONS = new XmlOptions();
|
||||
DEFAULT_XML_OPTIONS.setSaveOuter();
|
||||
DEFAULT_XML_OPTIONS.setUseDefaultNamespace();
|
||||
DEFAULT_XML_OPTIONS.setSaveAggressiveNamespaces();
|
||||
DEFAULT_XML_OPTIONS.setCharacterEncoding("UTF-8");
|
||||
DEFAULT_XML_OPTIONS.setLoadEntityBytesLimit(4096);
|
||||
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("http://schemas.openxmlformats.org/drawingml/2006/main", "a");
|
||||
map.put("http://schemas.openxmlformats.org/drawingml/2006/chart", "c");
|
||||
map.put("http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", "wp");
|
||||
map.put("http://schemas.openxmlformats.org/markup-compatibility/2006", "ve");
|
||||
map.put("http://schemas.openxmlformats.org/officeDocument/2006/math", "m");
|
||||
map.put("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "r");
|
||||
map.put("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", "vt");
|
||||
map.put("http://schemas.openxmlformats.org/presentationml/2006/main", "p");
|
||||
map.put("http://schemas.openxmlformats.org/wordprocessingml/2006/main", "w");
|
||||
map.put("http://schemas.microsoft.com/office/word/2006/wordml", "wne");
|
||||
map.put("urn:schemas-microsoft-com:office:office", "o");
|
||||
map.put("urn:schemas-microsoft-com:office:excel", "x");
|
||||
map.put("urn:schemas-microsoft-com:office:word", "w10");
|
||||
map.put("urn:schemas-microsoft-com:vml", "v");
|
||||
DEFAULT_XML_OPTIONS.setSaveSuggestedPrefixes(Collections.unmodifiableMap(map));
|
||||
}
|
||||
|
||||
public static XmlObject newInstance(SchemaType type, XmlOptions options) {
|
||||
XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;
|
||||
return XmlBeans.getContextTypeLoader().newInstance(type, opt);
|
||||
}
|
||||
|
||||
public static XmlObject parse(String xmlText, SchemaType type, XmlOptions options) throws XmlException {
|
||||
XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;
|
||||
return XmlBeans.getContextTypeLoader().parse(xmlText, type, opt);
|
||||
}
|
||||
|
||||
public static XmlObject parse(File file, SchemaType type, XmlOptions options) throws XmlException, IOException {
|
||||
XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;
|
||||
return XmlBeans.getContextTypeLoader().parse(file, type, opt);
|
||||
}
|
||||
|
||||
public static XmlObject parse(URL file, SchemaType type, XmlOptions options) throws XmlException, IOException {
|
||||
XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;
|
||||
return XmlBeans.getContextTypeLoader().parse(file, type, opt);
|
||||
}
|
||||
|
||||
public static XmlObject parse(InputStream jiois, SchemaType type, XmlOptions options) throws XmlException, IOException {
|
||||
XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;
|
||||
return XmlBeans.getContextTypeLoader().parse(jiois, type, opt);
|
||||
}
|
||||
|
||||
public static XmlObject parse(XMLStreamReader xsr, SchemaType type, XmlOptions options) throws XmlException {
|
||||
XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;
|
||||
return XmlBeans.getContextTypeLoader().parse(xsr, type, opt);
|
||||
}
|
||||
|
||||
public static XmlObject parse(Reader jior, SchemaType type, XmlOptions options) throws XmlException, IOException {
|
||||
XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;
|
||||
return XmlBeans.getContextTypeLoader().parse(jior, type, opt);
|
||||
}
|
||||
|
||||
public static XmlObject parse(Node node, SchemaType type, XmlOptions options) throws XmlException {
|
||||
XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;
|
||||
return XmlBeans.getContextTypeLoader().parse(node, type, opt);
|
||||
}
|
||||
|
||||
public static XmlObject parse(XMLInputStream xis, SchemaType type, XmlOptions options) throws XmlException, XMLStreamException {
|
||||
XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;
|
||||
return XmlBeans.getContextTypeLoader().parse(xis, type, opt);
|
||||
}
|
||||
|
||||
public static XMLInputStream newValidatingXMLInputStream ( XMLInputStream xis, SchemaType type, XmlOptions options ) throws XmlException, XMLStreamException {
|
||||
XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;
|
||||
return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream(xis, type, opt);
|
||||
}
|
||||
}
|
|
@ -16,11 +16,12 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi.poifs.crypt.agile;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
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;
|
||||
|
@ -112,7 +113,7 @@ public class AgileEncryptionInfoBuilder implements EncryptionInfoBuilder {
|
|||
|
||||
protected static EncryptionDocument parseDescriptor(String descriptor) {
|
||||
try {
|
||||
return EncryptionDocument.Factory.parse(descriptor, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
return EncryptionDocument.Factory.parse(descriptor, DEFAULT_XML_OPTIONS);
|
||||
} catch (XmlException e) {
|
||||
throw new EncryptedDocumentException("Unable to parse encryption descriptor", e);
|
||||
}
|
||||
|
@ -120,7 +121,7 @@ public class AgileEncryptionInfoBuilder implements EncryptionInfoBuilder {
|
|||
|
||||
protected static EncryptionDocument parseDescriptor(InputStream descriptor) {
|
||||
try {
|
||||
return EncryptionDocument.Factory.parse(descriptor, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
return EncryptionDocument.Factory.parse(descriptor, DEFAULT_XML_OPTIONS);
|
||||
} catch (Exception e) {
|
||||
throw new EncryptedDocumentException("Unable to parse encryption descriptor", e);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
package org.apache.poi.poifs.crypt.dsig;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
import static org.apache.poi.poifs.crypt.dsig.facets.SignatureFacet.XML_DIGSIG_NS;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
@ -68,7 +69,6 @@ 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;
|
||||
|
@ -213,7 +213,7 @@ public class SignatureInfo implements SignatureConfigurable {
|
|||
*/
|
||||
public SignatureDocument getSignatureDocument() throws IOException, XmlException {
|
||||
// TODO: check for XXE
|
||||
return SignatureDocument.Factory.parse(signaturePart.getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
return SignatureDocument.Factory.parse(signaturePart.getInputStream(), DEFAULT_XML_OPTIONS);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -631,7 +631,7 @@ public class SignatureInfo implements SignatureConfigurable {
|
|||
|
||||
try {
|
||||
OutputStream os = sigPart.getOutputStream();
|
||||
SignatureDocument sigDoc = SignatureDocument.Factory.parse(document, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
SignatureDocument sigDoc = SignatureDocument.Factory.parse(document, DEFAULT_XML_OPTIONS);
|
||||
sigDoc.save(os, xo);
|
||||
os.close();
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -24,9 +24,10 @@
|
|||
|
||||
package org.apache.poi.poifs.crypt.dsig.facets;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
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;
|
||||
|
@ -57,7 +58,7 @@ public class Office2010SignatureFacet extends SignatureFacet {
|
|||
|
||||
QualifyingPropertiesType qualProps;
|
||||
try {
|
||||
qualProps = QualifyingPropertiesType.Factory.parse(nl.item(0), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
qualProps = QualifyingPropertiesType.Factory.parse(nl.item(0), DEFAULT_XML_OPTIONS);
|
||||
} catch (XmlException e) {
|
||||
throw new MarshalException(e);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
package org.apache.poi.poifs.crypt.dsig.facets;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
import static org.apache.poi.poifs.crypt.dsig.facets.XAdESSignatureFacet.insertXChild;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -46,7 +47,6 @@ 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;
|
||||
|
@ -129,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), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
qualDoc = QualifyingPropertiesDocument.Factory.parse(qualNl.item(0), DEFAULT_XML_OPTIONS);
|
||||
} catch (XmlException e) {
|
||||
throw new MarshalException(e);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
package org.apache.poi.poifs.crypt.dsig.services;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
|
@ -48,7 +50,6 @@ 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;
|
||||
|
@ -142,7 +143,7 @@ public class RelationshipTransformService extends TransformService {
|
|||
Node parentNode = domParent.getNode();
|
||||
|
||||
try {
|
||||
TransformDocument transDoc = TransformDocument.Factory.parse(parentNode, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
TransformDocument transDoc = TransformDocument.Factory.parse(parentNode, DEFAULT_XML_OPTIONS);
|
||||
XmlObject xoList[] = transDoc.getTransform().selectChildren(RelationshipReferenceDocument.type.getDocumentElementName());
|
||||
if (xoList.length == 0) {
|
||||
LOG.log(POILogger.WARN, "no RelationshipReference/@SourceId parameters present");
|
||||
|
@ -188,7 +189,7 @@ public class RelationshipTransformService extends TransformService {
|
|||
|
||||
RelationshipsDocument relDoc;
|
||||
try {
|
||||
relDoc = RelationshipsDocument.Factory.parse(octetStream, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
relDoc = RelationshipsDocument.Factory.parse(octetStream, DEFAULT_XML_OPTIONS);
|
||||
} catch (Exception e) {
|
||||
throw new TransformException(e.getMessage(), e);
|
||||
}
|
||||
|
|
|
@ -17,13 +17,14 @@
|
|||
|
||||
package org.apache.poi.util;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
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;
|
||||
|
@ -50,7 +51,7 @@ public final class XmlSort
|
|||
File f = new File(args[0]);
|
||||
try
|
||||
{
|
||||
XmlObject docInstance = XmlObject.Factory.parse(f, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
XmlObject docInstance = XmlObject.Factory.parse(f, DEFAULT_XML_OPTIONS);
|
||||
XmlObject element = null;
|
||||
if (args.length > 1)
|
||||
{
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi.xslf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -51,9 +53,7 @@ import org.apache.poi.util.PackageHelper;
|
|||
import org.apache.poi.util.Units;
|
||||
import org.apache.xmlbeans.XmlException;
|
||||
import org.apache.xmlbeans.XmlObject;
|
||||
import org.apache.xmlbeans.XmlOptions;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties;
|
||||
import org.openxmlformats.schemas.officeDocument.x2006.relationships.STRelationshipId;
|
||||
import org.openxmlformats.schemas.presentationml.x2006.main.CTNotesMasterIdList;
|
||||
import org.openxmlformats.schemas.presentationml.x2006.main.CTNotesMasterIdListEntry;
|
||||
import org.openxmlformats.schemas.presentationml.x2006.main.CTPresentation;
|
||||
|
@ -127,7 +127,7 @@ implements SlideShow<XSLFShape,XSLFTextParagraph> {
|
|||
protected void onDocumentRead() throws IOException {
|
||||
try {
|
||||
PresentationDocument doc =
|
||||
PresentationDocument.Factory.parse(getCorePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
PresentationDocument.Factory.parse(getCorePart().getInputStream(), DEFAULT_XML_OPTIONS);
|
||||
_presentation = doc.getPresentation();
|
||||
|
||||
Map<String, XSLFSlideMaster> masterMap = new HashMap<String, XSLFSlideMaster>();
|
||||
|
@ -170,14 +170,9 @@ implements SlideShow<XSLFShape,XSLFTextParagraph> {
|
|||
|
||||
@Override
|
||||
protected void commit() throws IOException {
|
||||
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put(STRelationshipId.type.getName().getNamespaceURI(), "r");
|
||||
xmlOptions.setSaveSuggestedPrefixes(map);
|
||||
|
||||
PackagePart part = getPackagePart();
|
||||
OutputStream out = part.getOutputStream();
|
||||
_presentation.save(out, xmlOptions);
|
||||
_presentation.save(out, DEFAULT_XML_OPTIONS);
|
||||
out.close();
|
||||
}
|
||||
|
||||
|
|
|
@ -19,11 +19,17 @@
|
|||
|
||||
package org.apache.poi.xslf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
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;
|
||||
|
@ -31,12 +37,6 @@ import org.openxmlformats.schemas.drawingml.x2006.chart.CTChart;
|
|||
import org.openxmlformats.schemas.drawingml.x2006.chart.CTChartSpace;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.chart.ChartSpaceDocument;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Represents a Chart in a .pptx presentation
|
||||
*
|
||||
|
@ -66,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(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS).getChartSpace();
|
||||
chartSpace = ChartSpaceDocument.Factory.parse(part.getInputStream(), DEFAULT_XML_OPTIONS).getChartSpace();
|
||||
chart = chartSpace.getChart();
|
||||
}
|
||||
|
||||
|
@ -93,13 +93,7 @@ public final class XSLFChart extends POIXMLDocumentPart {
|
|||
@Override
|
||||
protected void commit() throws IOException {
|
||||
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
|
||||
|
||||
xmlOptions.setSaveSyntheticDocumentElement(new QName(CTChartSpace.type.getName().getNamespaceURI(), "chartSpace", "c"));
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("http://schemas.openxmlformats.org/drawingml/2006/main", "a");
|
||||
map.put("http://schemas.openxmlformats.org/drawingml/2006/chart", "c");
|
||||
map.put("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "r");
|
||||
xmlOptions.setSaveSuggestedPrefixes(map);
|
||||
|
||||
PackagePart part = getPackagePart();
|
||||
OutputStream out = part.getOutputStream();
|
||||
|
|
|
@ -17,13 +17,14 @@
|
|||
|
||||
package org.apache.poi.xslf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
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;
|
||||
|
@ -54,7 +55,7 @@ public class XSLFCommentAuthors extends POIXMLDocumentPart {
|
|||
super(part, rel);
|
||||
|
||||
CmAuthorLstDocument doc =
|
||||
CmAuthorLstDocument.Factory.parse(getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
CmAuthorLstDocument.Factory.parse(getPackagePart().getInputStream(), DEFAULT_XML_OPTIONS);
|
||||
_authors = doc.getCmAuthorLst();
|
||||
}
|
||||
|
||||
|
|
|
@ -17,18 +17,19 @@
|
|||
|
||||
package org.apache.poi.xslf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
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;
|
||||
import org.openxmlformats.schemas.presentationml.x2006.main.CmLstDocument;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Beta
|
||||
public class XSLFComments extends POIXMLDocumentPart {
|
||||
private final CTCommentList _comments;
|
||||
|
@ -54,7 +55,7 @@ public class XSLFComments extends POIXMLDocumentPart {
|
|||
super(part, rel);
|
||||
|
||||
CmLstDocument doc =
|
||||
CmLstDocument.Factory.parse(getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
CmLstDocument.Factory.parse(getPackagePart().getInputStream(), DEFAULT_XML_OPTIONS);
|
||||
_comments = doc.getCmLst();
|
||||
}
|
||||
|
||||
|
|
|
@ -17,11 +17,12 @@
|
|||
|
||||
package org.apache.poi.xslf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
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;
|
||||
|
@ -68,7 +69,7 @@ public class XSLFCommonSlideData {
|
|||
if (o instanceof XmlAnyTypeImpl) {
|
||||
// Pesky XmlBeans bug - see Bugzilla #49934
|
||||
try {
|
||||
o = CTTable.Factory.parse(o.toString(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
o = CTTable.Factory.parse(o.toString(), DEFAULT_XML_OPTIONS);
|
||||
} catch (XmlException e) {
|
||||
throw new POIXMLException(e);
|
||||
}
|
||||
|
|
|
@ -18,10 +18,11 @@
|
|||
|
||||
package org.apache.poi.xslf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.poi.POIXMLDocumentPart;
|
||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||
import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||
|
@ -49,7 +50,7 @@ public class XSLFMetroShape {
|
|||
try {
|
||||
pkg = OPCPackage.open(new ByteArrayInputStream(metroBytes));
|
||||
PackagePart shapePart = pkg.getPart(shapePN);
|
||||
CTGroupShape gs = CTGroupShape.Factory.parse(shapePart.getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
CTGroupShape gs = CTGroupShape.Factory.parse(shapePart.getInputStream(), DEFAULT_XML_OPTIONS);
|
||||
XSLFGroupShape xgs = new XSLFGroupShape(gs, null);
|
||||
return xgs.getShapes().get(0);
|
||||
} finally {
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi.xslf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -25,7 +27,6 @@ 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;
|
||||
|
@ -57,7 +58,7 @@ implements Notes<XSLFShape,XSLFTextParagraph> {
|
|||
super(part, rel);
|
||||
|
||||
NotesDocument doc =
|
||||
NotesDocument.Factory.parse(getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
NotesDocument.Factory.parse(getPackagePart().getInputStream(), DEFAULT_XML_OPTIONS);
|
||||
_notes = doc.getNotes();
|
||||
setCommonSlideData(_notes.getCSld());
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi.xslf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
|
@ -25,7 +27,6 @@ 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;
|
||||
|
@ -61,7 +62,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(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
NotesMasterDocument.Factory.parse(getPackagePart().getInputStream(), DEFAULT_XML_OPTIONS);
|
||||
_slide = doc.getNotesMaster();
|
||||
setCommonSlideData(_slide.getCSld());
|
||||
}
|
||||
|
@ -74,7 +75,7 @@ import org.openxmlformats.schemas.presentationml.x2006.main.NotesMasterDocument;
|
|||
|
||||
try {
|
||||
try {
|
||||
NotesMasterDocument doc = NotesMasterDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
NotesMasterDocument doc = NotesMasterDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);
|
||||
CTNotesMaster slide = doc.getNotesMaster();
|
||||
return slide;
|
||||
} finally {
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi.xslf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.awt.Graphics2D;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -25,6 +27,7 @@ import java.util.HashMap;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import org.apache.poi.POIXMLDocumentPart;
|
||||
|
@ -39,8 +42,8 @@ import org.apache.poi.sl.draw.DrawFactory;
|
|||
import org.apache.poi.sl.draw.DrawPictureShape;
|
||||
import org.apache.poi.sl.draw.Drawable;
|
||||
import org.apache.poi.sl.usermodel.PictureData;
|
||||
import org.apache.poi.sl.usermodel.SimpleShape.Placeholder;
|
||||
import org.apache.poi.sl.usermodel.Sheet;
|
||||
import org.apache.poi.sl.usermodel.SimpleShape.Placeholder;
|
||||
import org.apache.poi.util.Beta;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
import org.apache.poi.util.Internal;
|
||||
|
@ -312,12 +315,6 @@ implements XSLFShapeContainer, Sheet<XSLFShape,XSLFTextParagraph> {
|
|||
|
||||
protected final void commit() throws IOException {
|
||||
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
|
||||
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put(STRelationshipId.type.getName().getNamespaceURI(), "r");
|
||||
map.put("http://schemas.openxmlformats.org/drawingml/2006/main", "a");
|
||||
map.put("http://schemas.openxmlformats.org/presentationml/2006/main", "p");
|
||||
xmlOptions.setSaveSuggestedPrefixes(map);
|
||||
String docName = getRootElementName();
|
||||
if(docName != null) {
|
||||
xmlOptions.setSaveSyntheticDocumentElement(
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi.xslf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.awt.Graphics2D;
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -71,7 +73,7 @@ implements Slide<XSLFShape,XSLFTextParagraph> {
|
|||
super(part, rel);
|
||||
|
||||
SldDocument doc =
|
||||
SldDocument.Factory.parse(getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
SldDocument.Factory.parse(getPackagePart().getInputStream(), DEFAULT_XML_OPTIONS);
|
||||
_slide = doc.getSld();
|
||||
setCommonSlideData(_slide.getCSld());
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi.xslf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.poi.POIXMLDocumentPart;
|
||||
|
@ -45,7 +47,7 @@ implements MasterSheet<XSLFShape,XSLFTextParagraph> {
|
|||
public XSLFSlideLayout(PackagePart part, PackageRelationship rel) throws IOException, XmlException {
|
||||
super(part, rel);
|
||||
SldLayoutDocument doc =
|
||||
SldLayoutDocument.Factory.parse(getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
SldLayoutDocument.Factory.parse(getPackagePart().getInputStream(), DEFAULT_XML_OPTIONS);
|
||||
_layout = doc.getSldLayout();
|
||||
setCommonSlideData(_layout.getCSld());
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi.xslf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
|
@ -70,7 +72,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(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
SldMasterDocument.Factory.parse(getPackagePart().getInputStream(), DEFAULT_XML_OPTIONS);
|
||||
_slide = doc.getSldMaster();
|
||||
setCommonSlideData(_slide.getCSld());
|
||||
}
|
||||
|
|
|
@ -16,12 +16,13 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi.xslf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
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;
|
||||
|
@ -74,7 +75,7 @@ public class XSLFSlideShow extends POIXMLDocument {
|
|||
}
|
||||
|
||||
presentationDoc =
|
||||
PresentationDocument.Factory.parse(getCorePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
PresentationDocument.Factory.parse(getCorePart().getInputStream(), DEFAULT_XML_OPTIONS);
|
||||
|
||||
embedds = new LinkedList<PackagePart>();
|
||||
for (CTSlideIdListEntry ctSlide : getSlideReferences().getSldIdArray()) {
|
||||
|
@ -146,7 +147,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(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
SldMasterDocument.Factory.parse(masterPart.getInputStream(), DEFAULT_XML_OPTIONS);
|
||||
return masterDoc.getSldMaster();
|
||||
}
|
||||
|
||||
|
@ -166,7 +167,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(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
SldDocument.Factory.parse(slidePart.getInputStream(), DEFAULT_XML_OPTIONS);
|
||||
return slideDoc.getSld();
|
||||
}
|
||||
|
||||
|
@ -209,7 +210,7 @@ public class XSLFSlideShow extends POIXMLDocument {
|
|||
return null;
|
||||
|
||||
NotesDocument notesDoc =
|
||||
NotesDocument.Factory.parse(notesPart.getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
NotesDocument.Factory.parse(notesPart.getInputStream(), DEFAULT_XML_OPTIONS);
|
||||
|
||||
return notesDoc.getNotes();
|
||||
}
|
||||
|
@ -241,7 +242,7 @@ public class XSLFSlideShow extends POIXMLDocument {
|
|||
commentRels.getRelationship(0)
|
||||
);
|
||||
CmLstDocument commDoc =
|
||||
CmLstDocument.Factory.parse(cPart.getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
CmLstDocument.Factory.parse(cPart.getInputStream(), DEFAULT_XML_OPTIONS);
|
||||
return commDoc.getCmLst();
|
||||
} catch(InvalidFormatException e) {
|
||||
throw new IllegalStateException(e);
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
package org.apache.poi.xslf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
|
@ -26,7 +28,6 @@ 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;
|
||||
|
@ -68,7 +69,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(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
rs[0] = CTTable.Factory.parse(rs[0].toString(), DEFAULT_XML_OPTIONS);
|
||||
}catch (XmlException e){
|
||||
throw new POIXMLException(e);
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi.xslf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
@ -26,7 +28,6 @@ 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;
|
||||
|
@ -44,7 +45,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(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
_tblStyleLst = CTTableStyleList.Factory.parse(getPackagePart().getInputStream(), DEFAULT_XML_OPTIONS);
|
||||
CTTableStyle[] tblStyleArray = _tblStyleLst.getTblStyleArray();
|
||||
_styles = new ArrayList<XSLFTableStyle>(tblStyleArray.length);
|
||||
for(CTTableStyle c : tblStyleArray){
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi.xslf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
|
@ -27,7 +29,6 @@ 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;
|
||||
|
@ -58,7 +59,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(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
ThemeDocument.Factory.parse(getPackagePart().getInputStream(), DEFAULT_XML_OPTIONS);
|
||||
_theme = doc.getTheme();
|
||||
initialize();
|
||||
}
|
||||
|
@ -128,10 +129,6 @@ public class XSLFTheme extends POIXMLDocumentPart {
|
|||
|
||||
protected final void commit() throws IOException {
|
||||
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
|
||||
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("http://schemas.openxmlformats.org/drawingml/2006/main", "a");
|
||||
xmlOptions.setSaveSuggestedPrefixes(map);
|
||||
xmlOptions.setSaveSyntheticDocumentElement(
|
||||
new QName("http://schemas.openxmlformats.org/drawingml/2006/main", "theme"));
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package org.apache.poi.xssf.dev;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStream;
|
||||
|
@ -24,7 +26,6 @@ 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;
|
||||
|
@ -71,7 +72,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), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
XmlObject xml = XmlObject.Factory.parse(zip.getInputStream(entry), DEFAULT_XML_OPTIONS);
|
||||
XmlOptions options = new XmlOptions();
|
||||
options.setSavePrettyPrint();
|
||||
xml.save(out, options);
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi.xssf.eventusermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
|
@ -25,7 +27,6 @@ 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;
|
||||
|
@ -209,7 +210,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(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS).getWorkbook();
|
||||
CTWorkbook wbBean = WorkbookDocument.Factory.parse(wb.getInputStream(), DEFAULT_XML_OPTIONS).getWorkbook();
|
||||
sheetIterator = wbBean.getSheets().getSheetList().iterator();
|
||||
} catch (InvalidFormatException e){
|
||||
throw new POIXMLException(e);
|
||||
|
|
|
@ -16,16 +16,19 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi.xssf.model;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import org.apache.poi.POIXMLDocumentPart;
|
||||
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;
|
||||
import org.apache.xmlbeans.XmlException;
|
||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCalcCell;
|
||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCalcChain;
|
||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CalcChainDocument;
|
||||
|
||||
/**
|
||||
* The cells in a workbook can be calculated in different orders depending on various optimizations and
|
||||
|
@ -48,7 +51,7 @@ public class CalculationChain extends POIXMLDocumentPart {
|
|||
|
||||
public void readFrom(InputStream is) throws IOException {
|
||||
try {
|
||||
CalcChainDocument doc = CalcChainDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
CalcChainDocument doc = CalcChainDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);
|
||||
chain = doc.getCalcChain();
|
||||
} catch (XmlException e) {
|
||||
throw new IOException(e.getLocalizedMessage());
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi.xssf.model;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
@ -25,7 +27,6 @@ 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;
|
||||
|
@ -56,7 +57,7 @@ public class CommentsTable extends POIXMLDocumentPart {
|
|||
|
||||
public void readFrom(InputStream is) throws IOException {
|
||||
try {
|
||||
CommentsDocument doc = CommentsDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
CommentsDocument doc = CommentsDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);
|
||||
comments = doc.getComments();
|
||||
} catch (XmlException e) {
|
||||
throw new IOException(e.getLocalizedMessage());
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi.xssf.model;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
@ -28,7 +30,6 @@ 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;
|
||||
|
@ -55,7 +56,7 @@ public class ExternalLinksTable extends POIXMLDocumentPart {
|
|||
|
||||
public void readFrom(InputStream is) throws IOException {
|
||||
try {
|
||||
ExternalLinkDocument doc = ExternalLinkDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
ExternalLinkDocument doc = ExternalLinkDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);
|
||||
link = doc.getExternalLink();
|
||||
} catch (XmlException e) {
|
||||
throw new IOException(e.getLocalizedMessage());
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package org.apache.poi.xssf.model;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
@ -27,7 +29,6 @@ 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;
|
||||
|
@ -69,7 +70,7 @@ public class MapInfo extends POIXMLDocumentPart {
|
|||
@SuppressWarnings("deprecation")
|
||||
public void readFrom(InputStream is) throws IOException {
|
||||
try {
|
||||
MapInfoDocument doc = MapInfoDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
MapInfoDocument doc = MapInfoDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);
|
||||
mapInfo = doc.getMapInfo();
|
||||
|
||||
maps= new HashMap<Integer, XSSFMap>();
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package org.apache.poi.xssf.model;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
@ -116,7 +118,7 @@ public class SharedStringsTable extends POIXMLDocumentPart {
|
|||
public void readFrom(InputStream is) throws IOException {
|
||||
try {
|
||||
int cnt = 0;
|
||||
_sstDoc = SstDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
_sstDoc = SstDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);
|
||||
CTSst sst = _sstDoc.getSst();
|
||||
count = (int)sst.getCount();
|
||||
uniqueCount = (int)sst.getUniqueCount();
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package org.apache.poi.xssf.model;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
@ -26,7 +28,6 @@ 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;
|
||||
|
@ -62,7 +63,7 @@ public class SingleXmlCells extends POIXMLDocumentPart {
|
|||
|
||||
public void readFrom(InputStream is) throws IOException {
|
||||
try {
|
||||
SingleXmlCellsDocument doc = SingleXmlCellsDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
SingleXmlCellsDocument doc = SingleXmlCellsDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);
|
||||
singleXMLCells = doc.getSingleXmlCells();
|
||||
} catch (XmlException e) {
|
||||
throw new IOException(e.getLocalizedMessage());
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package org.apache.poi.xssf.model;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
@ -42,7 +44,6 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|||
import org.apache.poi.xssf.usermodel.extensions.XSSFCellBorder;
|
||||
import org.apache.poi.xssf.usermodel.extensions.XSSFCellFill;
|
||||
import org.apache.xmlbeans.XmlException;
|
||||
import org.apache.xmlbeans.XmlOptions;
|
||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorder;
|
||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorders;
|
||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCellStyleXfs;
|
||||
|
@ -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, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
doc = StyleSheetDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);
|
||||
|
||||
CTStylesheet styleSheet = doc.getStyleSheet();
|
||||
|
||||
|
@ -392,8 +393,6 @@ public class StylesTable extends POIXMLDocumentPart {
|
|||
* @throws IOException if an error occurs while writing.
|
||||
*/
|
||||
public void writeTo(OutputStream out) throws IOException {
|
||||
XmlOptions options = new XmlOptions(DEFAULT_XML_OPTIONS);
|
||||
|
||||
// Work on the current one
|
||||
// Need to do this, as we don't handle
|
||||
// all the possible entries yet
|
||||
|
@ -486,7 +485,7 @@ public class StylesTable extends POIXMLDocumentPart {
|
|||
}
|
||||
|
||||
// Save
|
||||
doc.save(out, options);
|
||||
doc.save(out, DEFAULT_XML_OPTIONS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,16 +16,16 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi.xssf.model;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
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;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTColor;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTColorScheme;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.main.ThemeDocument;
|
||||
|
@ -81,7 +81,7 @@ public class ThemesTable extends POIXMLDocumentPart {
|
|||
super(part, rel);
|
||||
|
||||
try {
|
||||
theme = ThemeDocument.Factory.parse(part.getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
theme = ThemeDocument.Factory.parse(part.getInputStream(), DEFAULT_XML_OPTIONS);
|
||||
} catch(XmlException e) {
|
||||
throw new IOException(e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
@ -166,9 +166,7 @@ public class ThemesTable extends POIXMLDocumentPart {
|
|||
* @throws IOException if an error occurs while writing.
|
||||
*/
|
||||
public void writeTo(OutputStream out) throws IOException {
|
||||
XmlOptions options = new XmlOptions(DEFAULT_XML_OPTIONS);
|
||||
|
||||
theme.save(out, options);
|
||||
theme.save(out, DEFAULT_XML_OPTIONS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
|
||||
package org.apache.poi.xssf.usermodel;
|
||||
|
||||
import org.apache.poi.POIXMLDocumentPart;
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import org.apache.poi.POIXMLException;
|
||||
import org.apache.poi.ss.usermodel.BorderStyle;
|
||||
import org.apache.poi.ss.usermodel.CellStyle;
|
||||
|
@ -154,12 +155,12 @@ public class XSSFCellStyle implements CellStyle {
|
|||
|
||||
// Create a new Xf with the same contents
|
||||
_cellXf = CTXf.Factory.parse(
|
||||
src.getCoreXf().toString(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS
|
||||
src.getCoreXf().toString(), DEFAULT_XML_OPTIONS
|
||||
);
|
||||
|
||||
// bug 56295: ensure that the fills is available and set correctly
|
||||
CTFill fill = CTFill.Factory.parse(
|
||||
src.getCTFill().toString(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS
|
||||
src.getCTFill().toString(), DEFAULT_XML_OPTIONS
|
||||
);
|
||||
addFill(fill);
|
||||
|
||||
|
@ -178,7 +179,7 @@ public class XSSFCellStyle implements CellStyle {
|
|||
// Copy the font
|
||||
try {
|
||||
CTFont ctFont = CTFont.Factory.parse(
|
||||
src.getFont().getCTFont().toString(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS
|
||||
src.getFont().getCTFont().toString(), DEFAULT_XML_OPTIONS
|
||||
);
|
||||
XSSFFont font = new XSSFFont(ctFont);
|
||||
font.registerTo(_stylesSource);
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
|
||||
package org.apache.poi.xssf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
|
@ -34,7 +34,6 @@ 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;
|
||||
|
@ -54,7 +53,6 @@ import org.openxmlformats.schemas.drawingml.x2006.chart.CTPrintSettings;
|
|||
import org.openxmlformats.schemas.drawingml.x2006.chart.CTTitle;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.chart.CTValAx;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.chart.ChartSpaceDocument;
|
||||
import org.openxmlformats.schemas.officeDocument.x2006.relationships.STRelationshipId;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.w3c.dom.Text;
|
||||
|
||||
|
@ -101,7 +99,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(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS).getChartSpace();
|
||||
chartSpace = ChartSpaceDocument.Factory.parse(part.getInputStream(), DEFAULT_XML_OPTIONS).getChartSpace();
|
||||
chart = chartSpace.getChart();
|
||||
}
|
||||
|
||||
|
@ -164,11 +162,6 @@ public final class XSSFChart extends POIXMLDocumentPart implements Chart, ChartA
|
|||
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
|
||||
*/
|
||||
xmlOptions.setSaveSyntheticDocumentElement(new QName(CTChartSpace.type.getName().getNamespaceURI(), "chartSpace", "c"));
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put(XSSFDrawing.NAMESPACE_A, "a");
|
||||
map.put(XSSFDrawing.NAMESPACE_C, "c");
|
||||
map.put(STRelationshipId.type.getName().getNamespaceURI(), "r");
|
||||
xmlOptions.setSaveSuggestedPrefixes(map);
|
||||
|
||||
PackagePart part = getPackagePart();
|
||||
OutputStream out = part.getOutputStream();
|
||||
|
@ -199,8 +192,8 @@ public final class XSSFChart extends POIXMLDocumentPart implements Chart, ChartA
|
|||
return this;
|
||||
}
|
||||
|
||||
public void plot(ChartData data, ChartAxis... axis) {
|
||||
data.fillChart(this, axis);
|
||||
public void plot(ChartData data, ChartAxis... chartAxis) {
|
||||
data.fillChart(this, chartAxis);
|
||||
}
|
||||
|
||||
public XSSFValueAxis createValueAxis(AxisPosition pos) {
|
||||
|
|
|
@ -17,23 +17,21 @@
|
|||
|
||||
package org.apache.poi.xssf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
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;
|
||||
import org.apache.xmlbeans.XmlException;
|
||||
import org.apache.xmlbeans.XmlOptions;
|
||||
import org.openxmlformats.schemas.officeDocument.x2006.relationships.STRelationshipId;
|
||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTChartsheet;
|
||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDrawing;
|
||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTLegacyDrawing;
|
||||
|
@ -62,7 +60,7 @@ public class XSSFChartSheet extends XSSFSheet {
|
|||
super.read(new ByteArrayInputStream(BLANK_WORKSHEET));
|
||||
|
||||
try {
|
||||
chartsheet = ChartsheetDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS).getChartsheet();
|
||||
chartsheet = ChartsheetDocument.Factory.parse(is, DEFAULT_XML_OPTIONS).getChartsheet();
|
||||
} catch (XmlException e){
|
||||
throw new POIXMLException(e);
|
||||
}
|
||||
|
@ -92,10 +90,6 @@ public class XSSFChartSheet extends XSSFSheet {
|
|||
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
|
||||
xmlOptions.setSaveSyntheticDocumentElement(
|
||||
new QName(CTChartsheet.type.getName().getNamespaceURI(), "chartsheet"));
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put(STRelationshipId.type.getName().getNamespaceURI(), "r");
|
||||
xmlOptions.setSaveSuggestedPrefixes(map);
|
||||
|
||||
chartsheet.save(out, xmlOptions);
|
||||
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.apache.poi.xssf.model.CommentsTable;
|
|||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComment;
|
||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRst;
|
||||
|
||||
import schemasMicrosoftComVml.CTShape;
|
||||
import com.microsoft.schemas.vml.CTShape;
|
||||
|
||||
public class XSSFComment implements Comment {
|
||||
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
|
||||
package org.apache.poi.xssf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
|
@ -41,8 +41,16 @@ import org.apache.xmlbeans.XmlCursor;
|
|||
import org.apache.xmlbeans.XmlException;
|
||||
import org.apache.xmlbeans.XmlObject;
|
||||
import org.apache.xmlbeans.XmlOptions;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.*;
|
||||
import org.openxmlformats.schemas.officeDocument.x2006.relationships.STRelationshipId;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTConnector;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTDrawing;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTGraphicalObjectFrame;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTGroupShape;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTOneCellAnchor;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTPicture;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShape;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTTwoCellAnchor;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.STEditAs;
|
||||
|
||||
/**
|
||||
* Represents a SpreadsheetML drawing
|
||||
|
@ -117,10 +125,6 @@ public final class XSSFDrawing extends POIXMLDocumentPart implements Drawing {
|
|||
xmlOptions.setSaveSyntheticDocumentElement(
|
||||
new QName(CTDrawing.type.getName().getNamespaceURI(), "wsDr", "xdr")
|
||||
);
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put(NAMESPACE_A, "a");
|
||||
map.put(STRelationshipId.type.getName().getNamespaceURI(), "r");
|
||||
xmlOptions.setSaveSuggestedPrefixes(map);
|
||||
|
||||
PackagePart part = getPackagePart();
|
||||
OutputStream out = part.getOutputStream();
|
||||
|
@ -297,7 +301,7 @@ public final class XSSFDrawing extends POIXMLDocumentPart implements Drawing {
|
|||
//create comments and vmlDrawing parts if they don't exist
|
||||
CommentsTable comments = sheet.getCommentsTable(true);
|
||||
XSSFVMLDrawing vml = sheet.getVMLDrawing(true);
|
||||
schemasMicrosoftComVml.CTShape vmlShape = vml.newCommentShape();
|
||||
com.microsoft.schemas.vml.CTShape vmlShape = vml.newCommentShape();
|
||||
if(ca.isSet()){
|
||||
// convert offsets from emus to pixels since we get a DrawingML-anchor
|
||||
// but create a VML Drawing
|
||||
|
|
|
@ -16,18 +16,17 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi.xssf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.apache.poi.POIXMLDocumentPart;
|
||||
import static org.apache.poi.POIXMLDocumentPart.DEFAULT_XML_OPTIONS;
|
||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||
import org.apache.poi.util.Beta;
|
||||
|
||||
import org.apache.xmlbeans.XmlException;
|
||||
import org.apache.xmlbeans.XmlOptions;
|
||||
|
||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPivotCache;
|
||||
|
||||
public class XSSFPivotCache extends POIXMLDocumentPart {
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi.xssf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi.xssf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi.xssf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package org.apache.poi.xssf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
import static org.apache.poi.xssf.usermodel.helpers.XSSFPaswordHelper.setPassword;
|
||||
import static org.apache.poi.xssf.usermodel.helpers.XSSFPaswordHelper.validatePassword;
|
||||
|
||||
|
@ -76,7 +77,6 @@ import org.apache.poi.xssf.usermodel.helpers.ColumnHelper;
|
|||
import org.apache.poi.xssf.usermodel.helpers.XSSFRowShifter;
|
||||
import org.apache.xmlbeans.XmlException;
|
||||
import org.apache.xmlbeans.XmlOptions;
|
||||
import org.openxmlformats.schemas.officeDocument.x2006.relationships.STRelationshipId;
|
||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTAutoFilter;
|
||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBreak;
|
||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCalcPr;
|
||||
|
@ -195,7 +195,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
|
|||
|
||||
protected void read(InputStream is) throws IOException {
|
||||
try {
|
||||
worksheet = WorksheetDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS).getWorksheet();
|
||||
worksheet = WorksheetDocument.Factory.parse(is, DEFAULT_XML_OPTIONS).getWorksheet();
|
||||
} catch (XmlException e){
|
||||
throw new POIXMLException(e);
|
||||
}
|
||||
|
@ -3306,9 +3306,6 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
|
|||
|
||||
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
|
||||
xmlOptions.setSaveSyntheticDocumentElement(new QName(CTWorksheet.type.getName().getNamespaceURI(), "worksheet"));
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put(STRelationshipId.type.getName().getNamespaceURI(), "r");
|
||||
xmlOptions.setSaveSuggestedPrefixes(map);
|
||||
|
||||
worksheet.save(out, xmlOptions);
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package org.apache.poi.xssf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
@ -28,7 +30,6 @@ 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;
|
||||
|
@ -70,7 +71,7 @@ public class XSSFTable extends POIXMLDocumentPart {
|
|||
|
||||
public void readFrom(InputStream is) throws IOException {
|
||||
try {
|
||||
TableDocument doc = TableDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
TableDocument doc = TableDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);
|
||||
ctTable = doc.getTable();
|
||||
} catch (XmlException e) {
|
||||
throw new IOException(e.getLocalizedMessage());
|
||||
|
|
|
@ -17,29 +17,41 @@
|
|||
|
||||
package org.apache.poi.xssf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
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;
|
||||
import org.apache.xmlbeans.XmlObject;
|
||||
import org.apache.xmlbeans.XmlCursor;
|
||||
import org.apache.xmlbeans.XmlException;
|
||||
import org.apache.xmlbeans.XmlObject;
|
||||
import org.w3c.dom.Node;
|
||||
import schemasMicrosoftComOfficeOffice.*;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.Matcher;
|
||||
import java.math.BigInteger;
|
||||
|
||||
import schemasMicrosoftComVml.*;
|
||||
import schemasMicrosoftComVml.STTrueFalse;
|
||||
import schemasMicrosoftComOfficeExcel.CTClientData;
|
||||
import schemasMicrosoftComOfficeExcel.STObjectType;
|
||||
import com.microsoft.schemas.office.excel.CTClientData;
|
||||
import com.microsoft.schemas.office.excel.STObjectType;
|
||||
import com.microsoft.schemas.office.office.CTIdMap;
|
||||
import com.microsoft.schemas.office.office.CTShapeLayout;
|
||||
import com.microsoft.schemas.office.office.STConnectType;
|
||||
import com.microsoft.schemas.office.office.STInsetMode;
|
||||
import com.microsoft.schemas.vml.CTPath;
|
||||
import com.microsoft.schemas.vml.CTShadow;
|
||||
import com.microsoft.schemas.vml.CTShape;
|
||||
import com.microsoft.schemas.vml.CTShapetype;
|
||||
import com.microsoft.schemas.vml.STExt;
|
||||
import com.microsoft.schemas.vml.STStrokeJoinStyle;
|
||||
import com.microsoft.schemas.vml.STTrueFalse;
|
||||
|
||||
/**
|
||||
* Represents a SpreadsheetML VML drawing.
|
||||
|
@ -107,7 +119,7 @@ public final class XSSFVMLDrawing extends POIXMLDocumentPart {
|
|||
|
||||
protected void read(InputStream is) throws IOException, XmlException {
|
||||
XmlObject root = XmlObject.Factory.parse(
|
||||
new EvilUnclosedBRFixingInputStream(is), POIXMLDocumentPart.DEFAULT_XML_OPTIONS
|
||||
new EvilUnclosedBRFixingInputStream(is), DEFAULT_XML_OPTIONS
|
||||
);
|
||||
|
||||
_qnames = new ArrayList<QName>();
|
||||
|
@ -116,13 +128,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(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS));
|
||||
_items.add(CTShapeLayout.Factory.parse(obj.xmlText(), DEFAULT_XML_OPTIONS));
|
||||
} else if (qname.equals(QNAME_SHAPE_TYPE)) {
|
||||
CTShapetype st = CTShapetype.Factory.parse(obj.xmlText(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
CTShapetype st = CTShapetype.Factory.parse(obj.xmlText(), DEFAULT_XML_OPTIONS);
|
||||
_items.add(st);
|
||||
_shapeTypeId = st.getId();
|
||||
} else if (qname.equals(QNAME_SHAPE)) {
|
||||
CTShape shape = CTShape.Factory.parse(obj.xmlText(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
CTShape shape = CTShape.Factory.parse(obj.xmlText(), DEFAULT_XML_OPTIONS);
|
||||
String id = shape.getId();
|
||||
if(id != null) {
|
||||
Matcher m = ptrn_shapeId.matcher(id);
|
||||
|
@ -130,7 +142,7 @@ public final class XSSFVMLDrawing extends POIXMLDocumentPart {
|
|||
}
|
||||
_items.add(shape);
|
||||
} else {
|
||||
_items.add(XmlObject.Factory.parse(obj.xmlText(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS));
|
||||
_items.add(XmlObject.Factory.parse(obj.xmlText(), DEFAULT_XML_OPTIONS));
|
||||
}
|
||||
_qnames.add(qname);
|
||||
}
|
||||
|
@ -160,15 +172,7 @@ public final class XSSFVMLDrawing extends POIXMLDocumentPart {
|
|||
}
|
||||
rootCursor.dispose();
|
||||
|
||||
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
|
||||
xmlOptions.setSavePrettyPrint();
|
||||
HashMap<String, String> map = new HashMap<String, String>();
|
||||
map.put("urn:schemas-microsoft-com:vml", "v");
|
||||
map.put("urn:schemas-microsoft-com:office:office", "o");
|
||||
map.put("urn:schemas-microsoft-com:office:excel", "x");
|
||||
xmlOptions.setSaveSuggestedPrefixes(map);
|
||||
|
||||
rootObject.save(out, xmlOptions);
|
||||
rootObject.save(out, DEFAULT_XML_OPTIONS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package org.apache.poi.xssf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
import static org.apache.poi.xssf.usermodel.helpers.XSSFPaswordHelper.setPassword;
|
||||
import static org.apache.poi.xssf.usermodel.helpers.XSSFPaswordHelper.validatePassword;
|
||||
|
||||
|
@ -80,7 +81,6 @@ import org.apache.poi.xssf.usermodel.helpers.XSSFFormulaUtils;
|
|||
import org.apache.xmlbeans.XmlException;
|
||||
import org.apache.xmlbeans.XmlObject;
|
||||
import org.apache.xmlbeans.XmlOptions;
|
||||
import org.openxmlformats.schemas.officeDocument.x2006.relationships.STRelationshipId;
|
||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBookView;
|
||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBookViews;
|
||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCalcPr;
|
||||
|
@ -333,7 +333,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(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
WorkbookDocument doc = WorkbookDocument.Factory.parse(getPackagePart().getInputStream(), DEFAULT_XML_OPTIONS);
|
||||
this.workbook = doc.getWorkbook();
|
||||
|
||||
ThemesTable theme = null;
|
||||
|
@ -1670,9 +1670,6 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook {
|
|||
|
||||
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
|
||||
xmlOptions.setSaveSyntheticDocumentElement(new QName(CTWorkbook.type.getName().getNamespaceURI(), "workbook"));
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put(STRelationshipId.type.getName().getNamespaceURI(), "r");
|
||||
xmlOptions.setSaveSuggestedPrefixes(map);
|
||||
|
||||
PackagePart part = getPackagePart();
|
||||
OutputStream out = part.getOutputStream();
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi.xwpf.model;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.poi.POIXMLDocumentPart;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||
|
@ -31,7 +31,6 @@ import org.apache.poi.xwpf.usermodel.XWPFHeader;
|
|||
import org.apache.poi.xwpf.usermodel.XWPFHeaderFooter;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFRelation;
|
||||
import org.apache.xmlbeans.XmlOptions;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBody;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHdrFtr;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHdrFtrRef;
|
||||
|
@ -46,18 +45,18 @@ import org.openxmlformats.schemas.wordprocessingml.x2006.main.HdrDocument;
|
|||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STHdrFtr;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STHdrFtr.Enum;
|
||||
|
||||
import schemasMicrosoftComOfficeOffice.CTLock;
|
||||
import schemasMicrosoftComOfficeOffice.STConnectType;
|
||||
import schemasMicrosoftComVml.CTFormulas;
|
||||
import schemasMicrosoftComVml.CTGroup;
|
||||
import schemasMicrosoftComVml.CTH;
|
||||
import schemasMicrosoftComVml.CTHandles;
|
||||
import schemasMicrosoftComVml.CTPath;
|
||||
import schemasMicrosoftComVml.CTShape;
|
||||
import schemasMicrosoftComVml.CTShapetype;
|
||||
import schemasMicrosoftComVml.CTTextPath;
|
||||
import schemasMicrosoftComVml.STExt;
|
||||
import schemasMicrosoftComVml.STTrueFalse;
|
||||
import com.microsoft.schemas.office.office.CTLock;
|
||||
import com.microsoft.schemas.office.office.STConnectType;
|
||||
import com.microsoft.schemas.vml.CTFormulas;
|
||||
import com.microsoft.schemas.vml.CTGroup;
|
||||
import com.microsoft.schemas.vml.CTH;
|
||||
import com.microsoft.schemas.vml.CTHandles;
|
||||
import com.microsoft.schemas.vml.CTPath;
|
||||
import com.microsoft.schemas.vml.CTShape;
|
||||
import com.microsoft.schemas.vml.CTShapetype;
|
||||
import com.microsoft.schemas.vml.CTTextPath;
|
||||
import com.microsoft.schemas.vml.STExt;
|
||||
import com.microsoft.schemas.vml.STTrueFalse;
|
||||
|
||||
/**
|
||||
* A .docx file can have no headers/footers, the same header/footer
|
||||
|
@ -176,10 +175,8 @@ public class XWPFHeaderFooterPolicy {
|
|||
OutputStream outputStream = wrapper.getPackagePart().getOutputStream();
|
||||
hdrDoc.setHdr(hdr);
|
||||
|
||||
XmlOptions xmlOptions = commit(wrapper);
|
||||
|
||||
assignHeader(wrapper, type);
|
||||
hdrDoc.save(outputStream, xmlOptions);
|
||||
hdrDoc.save(outputStream, DEFAULT_XML_OPTIONS);
|
||||
outputStream.close();
|
||||
|
||||
return wrapper;
|
||||
|
@ -213,10 +210,8 @@ public class XWPFHeaderFooterPolicy {
|
|||
OutputStream outputStream = wrapper.getPackagePart().getOutputStream();
|
||||
ftrDoc.setFtr(ftr);
|
||||
|
||||
XmlOptions xmlOptions = commit(wrapper);
|
||||
|
||||
assignFooter(wrapper, type);
|
||||
ftrDoc.save(outputStream, xmlOptions);
|
||||
ftrDoc.save(outputStream, DEFAULT_XML_OPTIONS);
|
||||
outputStream.close();
|
||||
return wrapper;
|
||||
}
|
||||
|
@ -299,22 +294,6 @@ public class XWPFHeaderFooterPolicy {
|
|||
}
|
||||
|
||||
|
||||
private XmlOptions commit(XWPFHeaderFooter wrapper) {
|
||||
XmlOptions xmlOptions = new XmlOptions(POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("http://schemas.openxmlformats.org/officeDocument/2006/math", "m");
|
||||
map.put("urn:schemas-microsoft-com:office:office", "o");
|
||||
map.put("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "r");
|
||||
map.put("urn:schemas-microsoft-com:vml", "v");
|
||||
map.put("http://schemas.openxmlformats.org/markup-compatibility/2006", "ve");
|
||||
map.put("http://schemas.openxmlformats.org/wordprocessingml/2006/main", "w");
|
||||
map.put("urn:schemas-microsoft-com:office:word", "w10");
|
||||
map.put("http://schemas.microsoft.com/office/word/2006/wordml", "wne");
|
||||
map.put("http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", "wp");
|
||||
xmlOptions.setSaveSuggestedPrefixes(map);
|
||||
return xmlOptions;
|
||||
}
|
||||
|
||||
public XWPFHeader getFirstPageHeader() {
|
||||
return firstPageHeader;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi.xwpf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -155,7 +157,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
|
|||
@Override
|
||||
protected void onDocumentRead() throws IOException {
|
||||
try {
|
||||
DocumentDocument doc = DocumentDocument.Factory.parse(getPackagePart().getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
DocumentDocument doc = DocumentDocument.Factory.parse(getPackagePart().getInputStream(), DEFAULT_XML_OPTIONS);
|
||||
ctDocument = doc.getDocument();
|
||||
|
||||
initFootnotes();
|
||||
|
@ -205,7 +207,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(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
CommentsDocument cmntdoc = CommentsDocument.Factory.parse(p.getPackagePart().getInputStream(), DEFAULT_XML_OPTIONS);
|
||||
for (CTComment ctcomment : cmntdoc.getComments().getCommentArray()) {
|
||||
comments.add(new XWPFComment(ctcomment, this));
|
||||
}
|
||||
|
@ -258,7 +260,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(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
EndnotesDocument endnotesDocument = EndnotesDocument.Factory.parse(p.getPackagePart().getInputStream(), DEFAULT_XML_OPTIONS);
|
||||
|
||||
for (CTFtnEdn ctFtnEdn : endnotesDocument.getEndnotes().getEndnoteArray()) {
|
||||
endnotes.put(ctFtnEdn.getId().intValue(), new XWPFFootnote(this, ctFtnEdn));
|
||||
|
@ -448,7 +450,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(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
StylesDocument sd = StylesDocument.Factory.parse(parts[0].getInputStream(), DEFAULT_XML_OPTIONS);
|
||||
return sd.getStyles();
|
||||
}
|
||||
|
||||
|
@ -704,17 +706,6 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
|
|||
protected void commit() throws IOException {
|
||||
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
|
||||
xmlOptions.setSaveSyntheticDocumentElement(new QName(CTDocument1.type.getName().getNamespaceURI(), "document"));
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("http://schemas.openxmlformats.org/officeDocument/2006/math", "m");
|
||||
map.put("urn:schemas-microsoft-com:office:office", "o");
|
||||
map.put("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "r");
|
||||
map.put("urn:schemas-microsoft-com:vml", "v");
|
||||
map.put("http://schemas.openxmlformats.org/markup-compatibility/2006", "ve");
|
||||
map.put("http://schemas.openxmlformats.org/wordprocessingml/2006/main", "w");
|
||||
map.put("urn:schemas-microsoft-com:office:word", "w10");
|
||||
map.put("http://schemas.microsoft.com/office/word/2006/wordml", "wne");
|
||||
map.put("http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", "wp");
|
||||
xmlOptions.setSaveSuggestedPrefixes(map);
|
||||
|
||||
PackagePart part = getPackagePart();
|
||||
OutputStream out = part.getOutputStream();
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi.xwpf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
|
@ -28,7 +28,6 @@ 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;
|
||||
|
@ -79,17 +78,6 @@ public class XWPFFooter extends XWPFHeaderFooter {
|
|||
protected void commit() throws IOException {
|
||||
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
|
||||
xmlOptions.setSaveSyntheticDocumentElement(new QName(CTNumbering.type.getName().getNamespaceURI(), "ftr"));
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("http://schemas.openxmlformats.org/markup-compatibility/2006", "ve");
|
||||
map.put("urn:schemas-microsoft-com:office:office", "o");
|
||||
map.put("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "r");
|
||||
map.put("http://schemas.openxmlformats.org/officeDocument/2006/math", "m");
|
||||
map.put("urn:schemas-microsoft-com:vml", "v");
|
||||
map.put("http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", "wp");
|
||||
map.put("urn:schemas-microsoft-com:office:word", "w10");
|
||||
map.put("http://schemas.openxmlformats.org/wordprocessingml/2006/main", "w");
|
||||
map.put("http://schemas.microsoft.com/office/word/2006/wordml", "wne");
|
||||
xmlOptions.setSaveSuggestedPrefixes(map);
|
||||
PackagePart part = getPackagePart();
|
||||
OutputStream out = part.getOutputStream();
|
||||
super._getHdrFtr().save(out, xmlOptions);
|
||||
|
@ -103,7 +91,7 @@ public class XWPFFooter extends XWPFHeaderFooter {
|
|||
InputStream is;
|
||||
try {
|
||||
is = getPackagePart().getInputStream();
|
||||
ftrDocument = FtrDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
ftrDocument = FtrDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);
|
||||
headerFooter = ftrDocument.getFtr();
|
||||
// parse the document with cursor and add
|
||||
// the XmlObject to its lists
|
||||
|
|
|
@ -17,13 +17,13 @@
|
|||
|
||||
package org.apache.poi.xwpf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
|
@ -32,7 +32,6 @@ 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.CTFootnotes;
|
||||
|
@ -72,7 +71,7 @@ public class XWPFFootnotes extends POIXMLDocumentPart {
|
|||
FootnotesDocument notesDoc;
|
||||
try {
|
||||
InputStream is = getPackagePart().getInputStream();
|
||||
notesDoc = FootnotesDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
notesDoc = FootnotesDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);
|
||||
ctFootnotes = notesDoc.getFootnotes();
|
||||
} catch (XmlException e) {
|
||||
throw new POIXMLException();
|
||||
|
@ -88,10 +87,6 @@ public class XWPFFootnotes extends POIXMLDocumentPart {
|
|||
protected void commit() throws IOException {
|
||||
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
|
||||
xmlOptions.setSaveSyntheticDocumentElement(new QName(CTFootnotes.type.getName().getNamespaceURI(), "footnotes"));
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "r");
|
||||
map.put("http://schemas.openxmlformats.org/wordprocessingml/2006/main", "w");
|
||||
xmlOptions.setSaveSuggestedPrefixes(map);
|
||||
PackagePart part = getPackagePart();
|
||||
OutputStream out = part.getOutputStream();
|
||||
ctFootnotes.save(out, xmlOptions);
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi.xwpf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
|
@ -28,7 +28,6 @@ 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;
|
||||
|
@ -77,17 +76,6 @@ public class XWPFHeader extends XWPFHeaderFooter {
|
|||
protected void commit() throws IOException {
|
||||
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
|
||||
xmlOptions.setSaveSyntheticDocumentElement(new QName(CTNumbering.type.getName().getNamespaceURI(), "hdr"));
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("http://schemas.openxmlformats.org/markup-compatibility/2006", "ve");
|
||||
map.put("urn:schemas-microsoft-com:office:office", "o");
|
||||
map.put("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "r");
|
||||
map.put("http://schemas.openxmlformats.org/officeDocument/2006/math", "m");
|
||||
map.put("urn:schemas-microsoft-com:vml", "v");
|
||||
map.put("http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", "wp");
|
||||
map.put("urn:schemas-microsoft-com:office:word", "w10");
|
||||
map.put("http://schemas.openxmlformats.org/wordprocessingml/2006/main", "w");
|
||||
map.put("http://schemas.microsoft.com/office/word/2006/wordml", "wne");
|
||||
xmlOptions.setSaveSuggestedPrefixes(map);
|
||||
PackagePart part = getPackagePart();
|
||||
OutputStream out = part.getOutputStream();
|
||||
super._getHdrFtr().save(out, xmlOptions);
|
||||
|
@ -106,7 +94,7 @@ public class XWPFHeader extends XWPFHeaderFooter {
|
|||
InputStream is;
|
||||
try {
|
||||
is = getPackagePart().getInputStream();
|
||||
hdrDocument = HdrDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
hdrDocument = HdrDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);
|
||||
headerFooter = hdrDocument.getHdr();
|
||||
// parse the document with cursor and add
|
||||
// the XmlObject to its lists
|
||||
|
|
|
@ -16,14 +16,14 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi.xwpf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
|
@ -32,7 +32,6 @@ 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;
|
||||
|
@ -76,7 +75,7 @@ public class XWPFNumbering extends POIXMLDocumentPart {
|
|||
InputStream is;
|
||||
is = getPackagePart().getInputStream();
|
||||
try {
|
||||
numberingDoc = NumberingDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
numberingDoc = NumberingDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);
|
||||
ctNumbering = numberingDoc.getNumbering();
|
||||
//get any Nums
|
||||
for (CTNum ctNum : ctNumbering.getNumArray()) {
|
||||
|
@ -98,17 +97,6 @@ public class XWPFNumbering extends POIXMLDocumentPart {
|
|||
protected void commit() throws IOException {
|
||||
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
|
||||
xmlOptions.setSaveSyntheticDocumentElement(new QName(CTNumbering.type.getName().getNamespaceURI(), "numbering"));
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("http://schemas.openxmlformats.org/markup-compatibility/2006", "ve");
|
||||
map.put("urn:schemas-microsoft-com:office:office", "o");
|
||||
map.put("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "r");
|
||||
map.put("http://schemas.openxmlformats.org/officeDocument/2006/math", "m");
|
||||
map.put("urn:schemas-microsoft-com:vml", "v");
|
||||
map.put("http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", "wp");
|
||||
map.put("urn:schemas-microsoft-com:office:word", "w10");
|
||||
map.put("http://schemas.openxmlformats.org/wordprocessingml/2006/main", "w");
|
||||
map.put("http://schemas.microsoft.com/office/word/2006/wordml", "wne");
|
||||
xmlOptions.setSaveSuggestedPrefixes(map);
|
||||
PackagePart part = getPackagePart();
|
||||
OutputStream out = part.getOutputStream();
|
||||
ctNumbering.save(out, xmlOptions);
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi.xwpf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigInteger;
|
||||
|
@ -25,7 +27,6 @@ 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;
|
||||
|
@ -177,7 +178,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(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
pict = CTPicture.Factory.parse(pict.toString(), DEFAULT_XML_OPTIONS);
|
||||
} catch (XmlException e) {
|
||||
throw new POIXMLException(e);
|
||||
}
|
||||
|
@ -958,7 +959,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, POIXMLDocumentPart.DEFAULT_XML_OPTIONS));
|
||||
inline.set(XmlToken.Factory.parse(xml, DEFAULT_XML_OPTIONS));
|
||||
|
||||
// Setup the inline
|
||||
inline.setDistT(0);
|
||||
|
|
|
@ -16,14 +16,14 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi.xwpf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.math.BigInteger;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
|
@ -33,7 +33,6 @@ 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;
|
||||
|
@ -383,9 +382,6 @@ public class XWPFSettings extends POIXMLDocumentPart {
|
|||
|
||||
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
|
||||
xmlOptions.setSaveSyntheticDocumentElement(new QName(CTSettings.type.getName().getNamespaceURI(), "settings"));
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("http://schemas.openxmlformats.org/wordprocessingml/2006/main", "w");
|
||||
xmlOptions.setSaveSuggestedPrefixes(map);
|
||||
|
||||
PackagePart part = getPackagePart();
|
||||
OutputStream out = part.getOutputStream();
|
||||
|
@ -404,7 +400,7 @@ public class XWPFSettings extends POIXMLDocumentPart {
|
|||
|
||||
private void readFrom(InputStream inputStream) {
|
||||
try {
|
||||
ctSettings = SettingsDocument.Factory.parse(inputStream, POIXMLDocumentPart.DEFAULT_XML_OPTIONS).getSettings();
|
||||
ctSettings = SettingsDocument.Factory.parse(inputStream, DEFAULT_XML_OPTIONS).getSettings();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
|
@ -17,13 +17,13 @@
|
|||
|
||||
package org.apache.poi.xwpf.usermodel;
|
||||
|
||||
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
|
@ -32,7 +32,6 @@ 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.CTDocDefaults;
|
||||
|
@ -83,7 +82,7 @@ public class XWPFStyles extends POIXMLDocumentPart {
|
|||
StylesDocument stylesDoc;
|
||||
try {
|
||||
InputStream is = getPackagePart().getInputStream();
|
||||
stylesDoc = StylesDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
|
||||
stylesDoc = StylesDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);
|
||||
setStyles(stylesDoc.getStyles());
|
||||
latentStyles = new XWPFLatentStyles(ctStyles.getLatentStyles(), this);
|
||||
} catch (XmlException e) {
|
||||
|
@ -99,10 +98,6 @@ public class XWPFStyles extends POIXMLDocumentPart {
|
|||
|
||||
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
|
||||
xmlOptions.setSaveSyntheticDocumentElement(new QName(CTStyles.type.getName().getNamespaceURI(), "styles"));
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "r");
|
||||
map.put("http://schemas.openxmlformats.org/wordprocessingml/2006/main", "w");
|
||||
xmlOptions.setSaveSuggestedPrefixes(map);
|
||||
PackagePart part = getPackagePart();
|
||||
OutputStream out = part.getOutputStream();
|
||||
ctStyles.save(out, xmlOptions);
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
====================================================================
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
====================================================================
|
||||
-->
|
||||
<xb:config xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config">
|
||||
|
||||
<xb:namespace uri="urn:schemas-microsoft-com:office:office">
|
||||
<xb:package>com.microsoft.schemas.office.office</xb:package>
|
||||
</xb:namespace>
|
||||
|
||||
<xb:namespace uri="urn:schemas-microsoft-com:office:excel">
|
||||
<xb:package>com.microsoft.schemas.office.excel</xb:package>
|
||||
</xb:namespace>
|
||||
|
||||
<xb:namespace uri="urn:schemas-microsoft-com:office:word">
|
||||
<xb:package>com.microsoft.schemas.office.word</xb:package>
|
||||
</xb:namespace>
|
||||
|
||||
<xb:namespace uri="urn:schemas-microsoft-com:office:powerpoint">
|
||||
<xb:package>com.microsoft.schemas.office.powerpoint</xb:package>
|
||||
</xb:namespace>
|
||||
|
||||
<xb:namespace uri="urn:schemas-microsoft-com:vml">
|
||||
<xb:package>com.microsoft.schemas.vml</xb:package>
|
||||
</xb:namespace>
|
||||
|
||||
</xb:config>
|
|
@ -49,7 +49,7 @@ import org.junit.Test;
|
|||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComment;
|
||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRPrElt;
|
||||
|
||||
import schemasMicrosoftComVml.CTShape;
|
||||
import com.microsoft.schemas.vml.CTShape;
|
||||
|
||||
/**
|
||||
* @author Yegor Kozlov
|
||||
|
@ -221,7 +221,7 @@ public final class TestXSSFComment extends BaseTestCellComment {
|
|||
.getSheetAt(0).getCommentsTable(true);
|
||||
XSSFVMLDrawing vml = ((SXSSFWorkbook) wb).getXSSFWorkbook()
|
||||
.getSheetAt(0).getVMLDrawing(true);
|
||||
schemasMicrosoftComVml.CTShape vmlShape1 = vml.newCommentShape();
|
||||
CTShape vmlShape1 = vml.newCommentShape();
|
||||
if (ca.isSet()) {
|
||||
String position = ca.getCol1() + ", 0, " + ca.getRow1()
|
||||
+ ", 0, " + ca.getCol2() + ", 0, " + ca.getRow2()
|
||||
|
@ -235,7 +235,7 @@ public final class TestXSSFComment extends BaseTestCellComment {
|
|||
shape1.setColumn(ca.getCol1());
|
||||
shape1.setRow(ca.getRow1());
|
||||
|
||||
schemasMicrosoftComVml.CTShape vmlShape2 = vml.newCommentShape();
|
||||
CTShape vmlShape2 = vml.newCommentShape();
|
||||
if (ca.isSet()) {
|
||||
String position = ca.getCol1() + ", 0, " + ca.getRow1()
|
||||
+ ", 0, " + ca.getCol2() + ", 0, " + ca.getRow2()
|
||||
|
|
|
@ -16,23 +16,27 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi.xssf.usermodel;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigInteger;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.poi.POIDataSamples;
|
||||
import org.apache.xmlbeans.XmlObject;
|
||||
|
||||
import schemasMicrosoftComVml.*;
|
||||
import schemasMicrosoftComOfficeOffice.CTShapeLayout;
|
||||
import schemasMicrosoftComOfficeOffice.STConnectType;
|
||||
import schemasMicrosoftComOfficeOffice.STInsetMode;
|
||||
import schemasMicrosoftComOfficeExcel.CTClientData;
|
||||
import schemasMicrosoftComOfficeExcel.STObjectType;
|
||||
import com.microsoft.schemas.office.excel.CTClientData;
|
||||
import com.microsoft.schemas.office.excel.STObjectType;
|
||||
import com.microsoft.schemas.office.office.CTShapeLayout;
|
||||
import com.microsoft.schemas.office.office.STConnectType;
|
||||
import com.microsoft.schemas.office.office.STInsetMode;
|
||||
import com.microsoft.schemas.vml.CTShadow;
|
||||
import com.microsoft.schemas.vml.CTShape;
|
||||
import com.microsoft.schemas.vml.CTShapetype;
|
||||
import com.microsoft.schemas.vml.STExt;
|
||||
import com.microsoft.schemas.vml.STTrueFalse;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
* @author Yegor Kozlov
|
||||
|
|
Loading…
Reference in New Issue