</buildCommand>
</buildSpec>
<natures>
+ <nature>org.sonar.ide.eclipse.core.sonarNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
<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 -->
<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"/>
</or>
</condition>
</target>
+
+ <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 -->
+ <condition property="ooxml.memory" value="768m" else="512m">
+ <equals arg1="${sun.arch.data.model}" arg2="64" />
+ </condition>
+
+ <taskdef name="xmlbean"
+ classname="org.apache.xmlbeans.impl.tool.XMLBean"
+ classpath="${ooxml.xmlbeans23.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}"/>
+
+ <copy todir="${xmlbean.xsds.dir}">
+ <xsds/>
+ </copy>
+
+ <!-- javasource > 1.5 will not generate all array accessor -->
+ <xmlbean
+ 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="@{noupa}"
+ nopvr="@{nopvr}"
+ >
+ <classpath refid="ooxml.classpath"/>
+ </xmlbean>
+
+ <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">
- <taskdef name="xmlbean"
- classname="org.apache.xmlbeans.impl.tool.XMLBean"
- classpath="${ooxml.xmlbeans23.jar}"/>
-
- <!-- 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 -->
- <condition property="ooxml.memory" value="768m" else="512m">
- <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>
-
- <!-- Now make a jar of the schema sources -->
- <jar
- basedir="${ooxml.xsds.src.dir}"
- destfile="${ooxml.xsds.src.jar}"
- />
-
+ <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 -->
- <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>
-
<!-- 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}"
- javasource="1.5"
- failonerror="true"
- fork="true"
- memoryMaximumSize="${ooxml.memory}"
- noupa="true"
- nopvr="true"
- >
- <classpath refid="ooxml.classpath"/>
- </xmlbean>
-
- <jar
- basedir="${ooxml.security.src.dir}"
- destfile="${ooxml.security.src.jar}"
- />
+ <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,
<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 -->
<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>
<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 -->
<execution>
<id>unzip-schema</id>
<phase>generate-sources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
<configuration>
<target>
<echo message="unzip schemas" />
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>
<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 -->
<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>
<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>
</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>
<artifactId>poi-scratchpad</artifactId>
<version>${project.version}</version>
</dependency>
-
- <dependency>
- <groupId>org.apache.xmlbeans</groupId>
- <artifactId>xmlbeans</artifactId>
- <version>2.6.0</version>
- </dependency>
+ <dependency>
+ <groupId>org.apache.xmlbeans</groupId>
+ <artifactId>xmlbeans</artifactId>
+ <version>2.6.0</version>
+ </dependency>
</dependencies>
</project>
-<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>
-
- <mailingLists>
- <mailingList>
- <name>POI Users List</name>
- <subscribe>user-subscribe@poi.apache.org</subscribe>
- <unsubscribe>user-unsubscribe@poi.apache.org</unsubscribe>
- <archive>http://mail-archives.apache.org/mod_mbox/poi-user/</archive>
- </mailingList>
- <mailingList>
- <name>POI Developer List</name>
- <subscribe>dev-subscribe@poi.apache.org</subscribe>
- <unsubscribe>dev-unsubscribe@poi.apache.org</unsubscribe>
- <archive>http://mail-archives.apache.org/mod_mbox/poi-dev/</archive>
- </mailingList>
- </mailingLists>
-
- <licenses>
- <license>
- <name>The Apache Software License, Version 2.0</name>
- <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
- </license>
- </licenses>
-
- <organization>
- <name>Apache Software Foundation</name>
- <url>http://www.apache.org/</url>
- </organization>
-
- <issueManagement>
+<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>
+
+ <mailingLists>
+ <mailingList>
+ <name>POI Users List</name>
+ <subscribe>user-subscribe@poi.apache.org</subscribe>
+ <unsubscribe>user-unsubscribe@poi.apache.org</unsubscribe>
+ <archive>http://mail-archives.apache.org/mod_mbox/poi-user/</archive>
+ </mailingList>
+ <mailingList>
+ <name>POI Developer List</name>
+ <subscribe>dev-subscribe@poi.apache.org</subscribe>
+ <unsubscribe>dev-unsubscribe@poi.apache.org</unsubscribe>
+ <archive>http://mail-archives.apache.org/mod_mbox/poi-dev/</archive>
+ </mailingList>
+ </mailingLists>
+
+ <licenses>
+ <license>
+ <name>The Apache Software License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ </license>
+ </licenses>
+
+ <organization>
+ <name>Apache Software Foundation</name>
+ <url>http://www.apache.org/</url>
+ </organization>
+
+ <issueManagement>
<system>bugzilla</system>
<url>https://issues.apache.org/bugzilla/</url>
</issueManagement>
-
- <scm>
+
+ <scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/poi/trunk</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/poi/trunk</developerConnection>
<url>http://svn.apache.org/viewvc/poi</url>
- </scm>
-
- <modules>
+ </scm>
+
+ <modules>
<module>main</module>
<module>ooxml-schema</module>
<module>ooxml-schema-encryption</module>
<module>ooxml</module>
<module>scratchpad</module>
<module>excelant</module>
- <module>examples</module>
- </modules>
-
+ <module>examples</module>
+ </modules>
+
<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>
-
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.1</version>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
-
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.1</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
<plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.16</version>
- <dependencies>
- <dependency>
- <groupId>org.apache.maven.surefire</groupId>
- <artifactId>surefire-junit47</artifactId>
- <version>2.16</version>
- </dependency>
- </dependencies>
-
- <configuration>
- <systemPropertyVariables>
- <POI.testdata.path>../../test-data</POI.testdata.path>
- <java.awt.headless>true</java.awt.headless>
- <org.apache.poi.util.POILogger>org.apache.poi.util.NullLogger</org.apache.poi.util.POILogger>
- </systemPropertyVariables>
- <!-- use to following to analyze OOM issues: -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp -->
- <argLine>-Duser.language=en -Duser.country=US -Xmx1024m</argLine>
- <excludes>
- <exclude>**/All*Tests.java</exclude>
- <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>
- </excludes>
- <!--test>TestPPTX2PNG</test-->
- <!--parallel>both</parallel>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.16</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>surefire-junit47</artifactId>
+ <version>2.16</version>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <systemPropertyVariables>
+ <POI.testdata.path>../../test-data</POI.testdata.path>
+ <java.awt.headless>true</java.awt.headless>
+ <org.apache.poi.util.POILogger>org.apache.poi.util.NullLogger</org.apache.poi.util.POILogger>
+ </systemPropertyVariables>
+ <!-- use to following to analyze OOM issues: -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp -->
+ <argLine>-Duser.language=en -Duser.country=US -Xmx1024m</argLine>
+ <excludes>
+ <exclude>**/All*Tests.java</exclude>
+ <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>
+ </excludes>
+ <!--test>TestPPTX2PNG</test-->
+ <!--parallel>both</parallel>
<threadCount>10</threadCount-->
- </configuration>
- </plugin>
- </plugins>
- </build>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ <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>
- <dependencies>
+ <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>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- <scope>test</scope>
+ <groupId>org.apache.xmlbeans</groupId>
+ <artifactId>xmlbeans</artifactId>
+ <version>2.6.0</version>
</dependency>
- </dependencies>
+ </dependencies>
+ </profile>
+ </profiles>
</project>
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.
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;
==================================================================== */
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;
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;
/**
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 {
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 {
}
}
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();
}
}
--- /dev/null
+/* ====================================================================\r
+ Licensed to the Apache Software Foundation (ASF) under one or more\r
+ contributor license agreements. See the NOTICE file distributed with\r
+ this work for additional information regarding copyright ownership.\r
+ The ASF licenses this file to You under the Apache License, Version 2.0\r
+ (the "License"); you may not use this file except in compliance with\r
+ the License. You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+==================================================================== */\r
+\r
+package org.apache.poi;\r
+\r
+import java.io.File;\r
+import java.io.IOException;\r
+import java.io.InputStream;\r
+import java.io.Reader;\r
+import java.net.URL;\r
+import java.util.Collections;\r
+import java.util.HashMap;\r
+import java.util.Map;\r
+\r
+import javax.xml.stream.XMLStreamReader;\r
+\r
+import org.apache.xmlbeans.SchemaType;\r
+import org.apache.xmlbeans.XmlBeans;\r
+import org.apache.xmlbeans.XmlException;\r
+import org.apache.xmlbeans.XmlObject;\r
+import org.apache.xmlbeans.XmlOptions;\r
+import org.apache.xmlbeans.xml.stream.XMLInputStream;\r
+import org.apache.xmlbeans.xml.stream.XMLStreamException;\r
+import org.w3c.dom.Node;\r
+\r
+@SuppressWarnings("deprecation")\r
+public class POIXMLTypeLoader {\r
+\r
+ public static final XmlOptions DEFAULT_XML_OPTIONS;\r
+ static {\r
+ DEFAULT_XML_OPTIONS = new XmlOptions();\r
+ DEFAULT_XML_OPTIONS.setSaveOuter();\r
+ DEFAULT_XML_OPTIONS.setUseDefaultNamespace();\r
+ DEFAULT_XML_OPTIONS.setSaveAggressiveNamespaces();\r
+ DEFAULT_XML_OPTIONS.setCharacterEncoding("UTF-8");\r
+ DEFAULT_XML_OPTIONS.setLoadEntityBytesLimit(4096);\r
+\r
+ Map<String, String> map = new HashMap<String, String>();\r
+ map.put("http://schemas.openxmlformats.org/drawingml/2006/main", "a");\r
+ map.put("http://schemas.openxmlformats.org/drawingml/2006/chart", "c");\r
+ map.put("http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", "wp");\r
+ map.put("http://schemas.openxmlformats.org/markup-compatibility/2006", "ve");\r
+ map.put("http://schemas.openxmlformats.org/officeDocument/2006/math", "m");\r
+ map.put("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "r");\r
+ map.put("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", "vt");\r
+ map.put("http://schemas.openxmlformats.org/presentationml/2006/main", "p");\r
+ map.put("http://schemas.openxmlformats.org/wordprocessingml/2006/main", "w");\r
+ map.put("http://schemas.microsoft.com/office/word/2006/wordml", "wne");\r
+ map.put("urn:schemas-microsoft-com:office:office", "o");\r
+ map.put("urn:schemas-microsoft-com:office:excel", "x");\r
+ map.put("urn:schemas-microsoft-com:office:word", "w10");\r
+ map.put("urn:schemas-microsoft-com:vml", "v");\r
+ DEFAULT_XML_OPTIONS.setSaveSuggestedPrefixes(Collections.unmodifiableMap(map));\r
+ }\r
+ \r
+ public static XmlObject newInstance(SchemaType type, XmlOptions options) {\r
+ XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;\r
+ return XmlBeans.getContextTypeLoader().newInstance(type, opt);\r
+ }\r
+\r
+ public static XmlObject parse(String xmlText, SchemaType type, XmlOptions options) throws XmlException {\r
+ XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;\r
+ return XmlBeans.getContextTypeLoader().parse(xmlText, type, opt);\r
+ }\r
+\r
+ public static XmlObject parse(File file, SchemaType type, XmlOptions options) throws XmlException, IOException {\r
+ XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;\r
+ return XmlBeans.getContextTypeLoader().parse(file, type, opt);\r
+ }\r
+\r
+ public static XmlObject parse(URL file, SchemaType type, XmlOptions options) throws XmlException, IOException {\r
+ XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;\r
+ return XmlBeans.getContextTypeLoader().parse(file, type, opt);\r
+ }\r
+\r
+ public static XmlObject parse(InputStream jiois, SchemaType type, XmlOptions options) throws XmlException, IOException {\r
+ XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;\r
+ return XmlBeans.getContextTypeLoader().parse(jiois, type, opt);\r
+ }\r
+\r
+ public static XmlObject parse(XMLStreamReader xsr, SchemaType type, XmlOptions options) throws XmlException {\r
+ XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;\r
+ return XmlBeans.getContextTypeLoader().parse(xsr, type, opt);\r
+ }\r
+\r
+ public static XmlObject parse(Reader jior, SchemaType type, XmlOptions options) throws XmlException, IOException {\r
+ XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;\r
+ return XmlBeans.getContextTypeLoader().parse(jior, type, opt);\r
+ }\r
+\r
+ public static XmlObject parse(Node node, SchemaType type, XmlOptions options) throws XmlException {\r
+ XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;\r
+ return XmlBeans.getContextTypeLoader().parse(node, type, opt);\r
+ }\r
+\r
+ public static XmlObject parse(XMLInputStream xis, SchemaType type, XmlOptions options) throws XmlException, XMLStreamException {\r
+ XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;\r
+ return XmlBeans.getContextTypeLoader().parse(xis, type, opt);\r
+ }\r
+ \r
+ public static XMLInputStream newValidatingXMLInputStream ( XMLInputStream xis, SchemaType type, XmlOptions options ) throws XmlException, XMLStreamException {\r
+ XmlOptions opt = (options == null) ? DEFAULT_XML_OPTIONS : options;\r
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream(xis, type, opt);\r
+ }\r
+}\r
==================================================================== */\r
package org.apache.poi.poifs.crypt.agile;\r
\r
+import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;\r
+\r
import java.io.IOException;\r
import java.io.InputStream;\r
\r
import org.apache.poi.EncryptedDocumentException;\r
-import org.apache.poi.POIXMLDocumentPart;\r
import org.apache.poi.poifs.crypt.ChainingMode;\r
import org.apache.poi.poifs.crypt.CipherAlgorithm;\r
import org.apache.poi.poifs.crypt.EncryptionInfo;\r
\r
protected static EncryptionDocument parseDescriptor(String descriptor) {\r
try {\r
- return EncryptionDocument.Factory.parse(descriptor, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);\r
+ return EncryptionDocument.Factory.parse(descriptor, DEFAULT_XML_OPTIONS);\r
} catch (XmlException e) {\r
throw new EncryptedDocumentException("Unable to parse encryption descriptor", e);\r
}\r
\r
protected static EncryptionDocument parseDescriptor(InputStream descriptor) {\r
try {\r
- return EncryptionDocument.Factory.parse(descriptor, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);\r
+ return EncryptionDocument.Factory.parse(descriptor, DEFAULT_XML_OPTIONS);\r
} catch (Exception e) {\r
throw new EncryptedDocumentException("Unable to parse encryption descriptor", e);\r
}\r
\r
package org.apache.poi.poifs.crypt.dsig;\r
\r
+import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;\r
import static org.apache.poi.poifs.crypt.dsig.facets.SignatureFacet.XML_DIGSIG_NS;\r
\r
import java.io.ByteArrayOutputStream;\r
import org.apache.jcp.xml.dsig.internal.dom.DOMReference;\r
import org.apache.jcp.xml.dsig.internal.dom.DOMSignedInfo;\r
import org.apache.poi.EncryptedDocumentException;\r
-import org.apache.poi.POIXMLDocumentPart;\r
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;\r
import org.apache.poi.openxml4j.opc.ContentTypes;\r
import org.apache.poi.openxml4j.opc.OPCPackage;\r
*/\r
public SignatureDocument getSignatureDocument() throws IOException, XmlException {\r
// TODO: check for XXE\r
- return SignatureDocument.Factory.parse(signaturePart.getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);\r
+ return SignatureDocument.Factory.parse(signaturePart.getInputStream(), DEFAULT_XML_OPTIONS);\r
}\r
\r
/**\r
\r
try {\r
OutputStream os = sigPart.getOutputStream();\r
- SignatureDocument sigDoc = SignatureDocument.Factory.parse(document, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);\r
+ SignatureDocument sigDoc = SignatureDocument.Factory.parse(document, DEFAULT_XML_OPTIONS);\r
sigDoc.save(os, xo);\r
os.close();\r
} catch (Exception e) {\r
\r
package org.apache.poi.poifs.crypt.dsig.facets;\r
\r
+import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;\r
+\r
import javax.xml.crypto.MarshalException;\r
\r
-import org.apache.poi.POIXMLDocumentPart;\r
import org.apache.xmlbeans.XmlException;\r
import org.etsi.uri.x01903.v13.QualifyingPropertiesType;\r
import org.etsi.uri.x01903.v13.UnsignedPropertiesType;\r
\r
QualifyingPropertiesType qualProps;\r
try {\r
- qualProps = QualifyingPropertiesType.Factory.parse(nl.item(0), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);\r
+ qualProps = QualifyingPropertiesType.Factory.parse(nl.item(0), DEFAULT_XML_OPTIONS);\r
} catch (XmlException e) {\r
throw new MarshalException(e);\r
}\r
\r
package org.apache.poi.poifs.crypt.dsig.facets;\r
\r
+import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;\r
import static org.apache.poi.poifs.crypt.dsig.facets.XAdESSignatureFacet.insertXChild;\r
\r
import java.io.ByteArrayInputStream;\r
\r
import javax.xml.crypto.MarshalException;\r
\r
-import org.apache.poi.POIXMLDocumentPart;\r
import org.apache.poi.poifs.crypt.dsig.services.RevocationData;\r
import org.apache.poi.util.POILogFactory;\r
import org.apache.poi.util.POILogger;\r
NodeList qualNl = document.getElementsByTagNameNS(XADES_132_NS, "QualifyingProperties");\r
if (qualNl.getLength() == 1) {\r
try {\r
- qualDoc = QualifyingPropertiesDocument.Factory.parse(qualNl.item(0), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);\r
+ qualDoc = QualifyingPropertiesDocument.Factory.parse(qualNl.item(0), DEFAULT_XML_OPTIONS);\r
} catch (XmlException e) {\r
throw new MarshalException(e);\r
}\r
\r
package org.apache.poi.poifs.crypt.dsig.services;\r
\r
+import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;\r
+\r
import java.io.ByteArrayInputStream;\r
import java.io.ByteArrayOutputStream;\r
import java.io.IOException;\r
import javax.xml.crypto.dsig.TransformService;\r
import javax.xml.crypto.dsig.spec.TransformParameterSpec;\r
\r
-import org.apache.poi.POIXMLDocumentPart;\r
import org.apache.poi.util.POILogFactory;\r
import org.apache.poi.util.POILogger;\r
import org.apache.poi.util.XmlSort;\r
Node parentNode = domParent.getNode();\r
\r
try {\r
- TransformDocument transDoc = TransformDocument.Factory.parse(parentNode, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);\r
+ TransformDocument transDoc = TransformDocument.Factory.parse(parentNode, DEFAULT_XML_OPTIONS);\r
XmlObject xoList[] = transDoc.getTransform().selectChildren(RelationshipReferenceDocument.type.getDocumentElementName());\r
if (xoList.length == 0) {\r
LOG.log(POILogger.WARN, "no RelationshipReference/@SourceId parameters present");\r
\r
RelationshipsDocument relDoc;\r
try {\r
- relDoc = RelationshipsDocument.Factory.parse(octetStream, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);\r
+ relDoc = RelationshipsDocument.Factory.parse(octetStream, DEFAULT_XML_OPTIONS);\r
} catch (Exception e) {\r
throw new TransformException(e.getMessage(), e);\r
}\r
\r
package org.apache.poi.util;\r
\r
+import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;\r
+\r
import java.io.File;\r
import java.io.IOException;\r
import java.util.Comparator;\r
\r
import javax.xml.namespace.QName;\r
\r
-import org.apache.poi.POIXMLDocumentPart;\r
import org.apache.xmlbeans.XmlCursor;\r
import org.apache.xmlbeans.XmlException;\r
import org.apache.xmlbeans.XmlObject;\r
File f = new File(args[0]);\r
try\r
{\r
- XmlObject docInstance = XmlObject.Factory.parse(f, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);\r
+ XmlObject docInstance = XmlObject.Factory.parse(f, DEFAULT_XML_OPTIONS);\r
XmlObject element = null;\r
if (args.length > 1)\r
{\r
==================================================================== */
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;
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;
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>();
@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();
}
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;
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
*
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();
}
@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();
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;
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();
}
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;
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();
}
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;
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);
}
\r
package org.apache.poi.xslf.usermodel;\r
\r
+import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;\r
+\r
import java.io.ByteArrayInputStream;\r
import java.io.IOException;\r
\r
-import org.apache.poi.POIXMLDocumentPart;\r
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;\r
import org.apache.poi.openxml4j.opc.OPCPackage;\r
import org.apache.poi.openxml4j.opc.PackagePart;\r
try {\r
pkg = OPCPackage.open(new ByteArrayInputStream(metroBytes));\r
PackagePart shapePart = pkg.getPart(shapePN);\r
- CTGroupShape gs = CTGroupShape.Factory.parse(shapePart.getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);\r
+ CTGroupShape gs = CTGroupShape.Factory.parse(shapePart.getInputStream(), DEFAULT_XML_OPTIONS);\r
XSLFGroupShape xgs = new XSLFGroupShape(gs, null);\r
return xgs.getShapes().get(0); \r
} finally {\r
==================================================================== */
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;
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;
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());
}
==================================================================== */
package org.apache.poi.xslf.usermodel;
+import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
+
import java.io.IOException;
import java.io.InputStream;
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;
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());
}
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 {
==================================================================== */
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;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+
import javax.xml.namespace.QName;
import org.apache.poi.POIXMLDocumentPart;
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;
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(
==================================================================== */
package org.apache.poi.xslf.usermodel;
+import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
+
import java.awt.Graphics2D;
import java.io.IOException;
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());
}
==================================================================== */
package org.apache.poi.xslf.usermodel;
+import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
+
import java.io.IOException;
import org.apache.poi.POIXMLDocumentPart;
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());
}
==================================================================== */
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;
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());
}
==================================================================== */
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;
}
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()) {
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();
}
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();
}
return null;
NotesDocument notesDoc =
- NotesDocument.Factory.parse(notesPart.getInputStream(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
+ NotesDocument.Factory.parse(notesPart.getInputStream(), DEFAULT_XML_OPTIONS);
return notesDoc.getNotes();
}
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);
\r
package org.apache.poi.xslf.usermodel;\r
\r
+import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;\r
+\r
import java.util.ArrayList;\r
import java.util.Collections;\r
import java.util.Iterator;\r
\r
import javax.xml.namespace.QName;\r
\r
-import org.apache.poi.POIXMLDocumentPart;\r
import org.apache.poi.POIXMLException;\r
import org.apache.poi.sl.usermodel.TableShape;\r
import org.apache.poi.util.Internal;\r
// it never happens when using the full ooxml-schemas jar but may happen with the abridged poi-ooxml-schemas\r
if(rs[0] instanceof XmlAnyTypeImpl){\r
try {\r
- rs[0] = CTTable.Factory.parse(rs[0].toString(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);\r
+ rs[0] = CTTable.Factory.parse(rs[0].toString(), DEFAULT_XML_OPTIONS);\r
}catch (XmlException e){\r
throw new POIXMLException(e);\r
}\r
==================================================================== */
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;
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;
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){
==================================================================== */
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;
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;
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();
}
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"));
+ new QName("http://schemas.openxmlformats.org/drawingml/2006/main", "theme"));
PackagePart part = getPackagePart();
OutputStream out = part.getOutputStream();
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;
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;
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);
==================================================================== */
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;
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;
}
//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);
==================================================================== */
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
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());
==================================================================== */
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.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;
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());
==================================================================== */
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.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;
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());
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.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;
@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>();
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;
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();
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.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;
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());
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.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;
@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();
* @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
}
// Save
- doc.save(out, options);
+ doc.save(out, DEFAULT_XML_OPTIONS);
}
@Override
==================================================================== */
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;
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);
}
* @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
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;
// 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);
// 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);
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;
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;
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;
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();
}
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();
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) {
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;
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);
}
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);
}
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 {
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;
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
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();
//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
==================================================================== */
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 {
XmlOptions options = new XmlOptions(DEFAULT_XML_OPTIONS);
//Removing root element
options.setLoadReplaceDocumentElement(null);
- ctPivotCache = CTPivotCache.Factory.parse(is, options);
+ ctPivotCache = CTPivotCache.Factory.parse(is, options);
} catch (XmlException e) {
throw new IOException(e.getLocalizedMessage());
}
==================================================================== */
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;
==================================================================== */
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;
==================================================================== */
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;
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;
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;
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);
}
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);
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 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;
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());
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.XmlCursor;
import org.apache.xmlbeans.XmlException;
-import org.apache.xmlbeans.XmlOptions;
import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlCursor;
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.
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>();
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);
}
_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);
}
}
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
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;
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;
@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;
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();
==================================================================== */
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;
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;
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
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;
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;
}
}
- 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;
}
==================================================================== */
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;
@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();
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));
}
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));
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();
}
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();
==================================================================== */
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;
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;
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);
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
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;
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;\r
-import org.apache.xmlbeans.XmlOptions;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFootnotes;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn;\r
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlOptions;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFootnotes;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.FootnotesDocument;\r
\r
/**\r
FootnotesDocument notesDoc;\r
try {\r
InputStream is = getPackagePart().getInputStream();\r
- 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();
protected void commit() throws IOException {\r
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);\r
xmlOptions.setSaveSyntheticDocumentElement(new QName(CTFootnotes.type.getName().getNamespaceURI(), "footnotes"));\r
- Map<String, String> map = new HashMap<String, String>();\r
- map.put("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "r");\r
- map.put("http://schemas.openxmlformats.org/wordprocessingml/2006/main", "w");\r
- xmlOptions.setSaveSuggestedPrefixes(map);\r
PackagePart part = getPackagePart();
OutputStream out = part.getOutputStream();
ctFootnotes.save(out, xmlOptions);
==================================================================== */
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;
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;
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);
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
==================================================================== */
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;
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;
InputStream is;\r
is = getPackagePart().getInputStream();\r
try {\r
- numberingDoc = NumberingDocument.Factory.parse(is, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);\r
+ numberingDoc = NumberingDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);\r
ctNumbering = numberingDoc.getNumbering();\r
//get any Nums\r
for (CTNum ctNum : ctNumbering.getNumArray()) {\r
protected void commit() throws IOException {\r
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);\r
xmlOptions.setSaveSyntheticDocumentElement(new QName(CTNumbering.type.getName().getNamespaceURI(), "numbering"));\r
- Map<String, String> map = new HashMap<String, String>();\r
- map.put("http://schemas.openxmlformats.org/markup-compatibility/2006", "ve");\r
- map.put("urn:schemas-microsoft-com:office:office", "o");\r
- map.put("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "r");\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);
==================================================================== */
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;
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;
if (pict instanceof XmlAnyTypeImpl) {\r
// Pesky XmlBeans bug - see Bugzilla #49934\r
try {\r
- pict = CTPicture.Factory.parse(pict.toString(), POIXMLDocumentPart.DEFAULT_XML_OPTIONS);\r
+ pict = CTPicture.Factory.parse(pict.toString(), DEFAULT_XML_OPTIONS);\r
} catch (XmlException e) {\r
throw new POIXMLException(e);\r
}\r
"<pic:pic xmlns:pic=\"" + CTPicture.type.getName().getNamespaceURI() + "\" />" +\r
"</a:graphicData>" +\r
"</a:graphic>";\r
- inline.set(XmlToken.Factory.parse(xml, POIXMLDocumentPart.DEFAULT_XML_OPTIONS));\r
+ inline.set(XmlToken.Factory.parse(xml, DEFAULT_XML_OPTIONS));\r
\r
// Setup the inline\r
inline.setDistT(0);
==================================================================== */
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;
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;
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();
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);
}
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;
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;\r
-import org.apache.xmlbeans.XmlOptions;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDocDefaults;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFonts;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTLanguage;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPPrDefault;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPrDefault;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTStyle;\r
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTStyles;\r
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlOptions;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDocDefaults;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFonts;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTLanguage;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPPrDefault;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPrDefault;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTStyle;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTStyles;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.StylesDocument;\r
\r
/**\r
StylesDocument stylesDoc;\r
try {\r
InputStream is = getPackagePart().getInputStream();\r
- 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) {
\r
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);\r
xmlOptions.setSaveSyntheticDocumentElement(new QName(CTStyles.type.getName().getNamespaceURI(), "styles"));\r
- Map<String, String> map = new HashMap<String, String>();\r
- map.put("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "r");\r
- map.put("http://schemas.openxmlformats.org/wordprocessingml/2006/main", "w");\r
- xmlOptions.setSaveSuggestedPrefixes(map);\r
PackagePart part = getPackagePart();
OutputStream out = part.getOutputStream();
ctStyles.save(out, xmlOptions);
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!--\r
+ ====================================================================\r
+ Licensed to the Apache Software Foundation (ASF) under one or more\r
+ contributor license agreements. See the NOTICE file distributed with\r
+ this work for additional information regarding copyright ownership.\r
+ The ASF licenses this file to You under the Apache License, Version 2.0\r
+ (the "License"); you may not use this file except in compliance with\r
+ the License. You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+ ====================================================================\r
+-->\r
+<xb:config xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config">\r
+\r
+ <xb:namespace uri="urn:schemas-microsoft-com:office:office">\r
+ <xb:package>com.microsoft.schemas.office.office</xb:package>\r
+ </xb:namespace>\r
+\r
+ <xb:namespace uri="urn:schemas-microsoft-com:office:excel">\r
+ <xb:package>com.microsoft.schemas.office.excel</xb:package>\r
+ </xb:namespace>\r
+\r
+ <xb:namespace uri="urn:schemas-microsoft-com:office:word">\r
+ <xb:package>com.microsoft.schemas.office.word</xb:package>\r
+ </xb:namespace>\r
+\r
+ <xb:namespace uri="urn:schemas-microsoft-com:office:powerpoint">\r
+ <xb:package>com.microsoft.schemas.office.powerpoint</xb:package>\r
+ </xb:namespace>\r
+\r
+ <xb:namespace uri="urn:schemas-microsoft-com:vml">\r
+ <xb:package>com.microsoft.schemas.vml</xb:package>\r
+ </xb:namespace>\r
+\r
+</xb:config>
\ No newline at end of file
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
.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()
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()
==================================================================== */
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