]> source.dussan.org Git - poi.git/commitdiff
#61939 - Provide schema for AlternateContent - provide new ooxml-schemas-1.4.jar
authorAndreas Beeker <kiwiwings@apache.org>
Sat, 30 Dec 2017 22:17:55 +0000 (22:17 +0000)
committerAndreas Beeker <kiwiwings@apache.org>
Sat, 30 Dec 2017 22:17:55 +0000 (22:17 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1819690 13f79535-47bb-0310-9956-ffa450edef68

.classpath
build.xml
src/ooxml/resources/org/apache/poi/schemas/markup-compatibility.xsd [new file with mode: 0644]
src/ooxml/resources/org/apache/poi/schemas/ooxmlSchemas.xsdconfig

index d6179e2dfb0e36118a450d565b9a8b7c45127bba..54aafe080ff5cbc047bbf3ea2253edb4499348ea 100644 (file)
@@ -22,7 +22,7 @@
        <classpathentry kind="lib" path="lib/hamcrest-core-1.3.jar"/>
        <classpathentry kind="lib" path="lib/junit-4.12.jar"/>
        <classpathentry kind="lib" path="ooxml-lib/curvesapi-1.05.jar"/>
-       <classpathentry exported="true" kind="lib" path="ooxml-lib/ooxml-schemas-1.3.jar" sourcepath="ooxml-lib/ooxml-schemas-1.3-sources.jar"/>
+       <classpathentry exported="true" kind="lib" path="ooxml-lib/ooxml-schemas-1.4.jar" sourcepath="ooxml-lib/ooxml-schemas-1.4-sources.jar"/>
        <classpathentry exported="true" kind="lib" path="ooxml-lib/ooxml-security-1.1.jar" sourcepath="ooxml-lib/ooxml-security-1.1-sources.jar"/>
        <classpathentry kind="lib" path="lib/jmh-core-1.19.jar"/>
        <classpathentry kind="lib" path="lib/jmh-generator-annprocess-1.19.jar"/>
index 092d07c5f9a323a637e6391b1cef55d735dda88f..2dc963bd36c37489ee182b5eb15f0403f64bb5f8 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -208,15 +208,18 @@ under the License.
     <property name="forbidden.jar" location="${main.lib}/forbiddenapis-2.3.jar"/>
     <property name="forbidden.url" value="${repository.m2}/maven2/de/thetaphi/forbiddenapis/2.3/forbiddenapis-2.3.jar"/>
 
-    <!-- See http://www.ecma-international.org/publications/standards/Ecma-376.htm -->
+    <property name="maven.ooxml.xsds.version.id" value="1.4"/>
+    <property name="maven.ooxml.xsds.jar" value="${maven.ooxml.xsds.version.id}.jar"/>
+       
+       <!-- See http://www.ecma-international.org/publications/standards/Ecma-376.htm -->
     <!-- "Copy these file(s), free of charge" -->
     <property name="ooxml.xsds.ozip.1" value="OfficeOpenXML-Part4.zip"/>
     <property name="ooxml.xsds.izip.1" value="OfficeOpenXML-XMLSchema.zip"/>
     <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.3-sources.jar"/>
-    <property name="ooxml.xsds.jar" location="${ooxml.lib}/ooxml-schemas-1.3.jar"/>
+    <property name="ooxml.xsds.src.jar" location="${ooxml.lib}/ooxml-schemas-${maven.ooxml.xsds.version.id}-sources.jar"/>
+    <property name="ooxml.xsds.jar" location="${ooxml.lib}/ooxml-schemas-${maven.ooxml.xsds.version.id}.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 -->
@@ -234,10 +237,6 @@ under the License.
     <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.3"/>
-    <property name="maven.ooxml.xsds.jar" value="ooxml-schemas-${maven.ooxml.xsds.version.id}.jar"/>
-
     <!-- Coverage -->
     <property name="coverage.dir" value="build/coverage"/>
     <!-- Exclude some uninteresting classes from coverage-instrumentation as we do not want to measure coverage in those packages anyway -->
@@ -592,6 +591,8 @@ under the License.
                 <include name="ooxml-schemas-1.1.jar"/>
                 <include name="ooxml-schemas-1.2-sources.jar"/>
                 <include name="ooxml-schemas-1.2.jar"/>
+                <include name="ooxml-schemas-1.3-sources.jar"/>
+                <include name="ooxml-schemas-1.3.jar"/>
                 <include name="ooxml-security-1.0-sources.jar"/>
                 <include name="ooxml-security-1.0.jar"/>
                 <include name="curvesapi-1.03.jar"/>
diff --git a/src/ooxml/resources/org/apache/poi/schemas/markup-compatibility.xsd b/src/ooxml/resources/org/apache/poi/schemas/markup-compatibility.xsd
new file mode 100644 (file)
index 0000000..6be17c0
--- /dev/null
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+   ====================================================================
+-->
+<xsd:schema
+       attributeFormDefault="unqualified" elementFormDefault="qualified"
+       targetNamespace="http://schemas.openxmlformats.org/markup-compatibility/2006"
+       xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+       >
+       <!-- based on https://github.com/plutext/docx4j/blob/master/xsd/mce/markup-compatibility-2006-MINIMAL.xsd -->
+
+       <!-- This XSD has 2 objectives:
+       
+               1. round tripping @mc:Ignorable <w:document 
+               xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+               xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" 
+               mc:Ignorable="w14 w15 wp14"> 
+               
+               2. enabling AlternateContent to be manipulated 
+               in certain elements (in the unusual case where the content model is xsd:any, 
+               it doesn't have to be explicitly added) See further ECMA-376, 4th Edition, 
+               Office Open XML File Formats Part 3 : Markup Compatibility and Extensibility 
+       -->
+
+       <!-- Objective 1 -->
+       <xsd:attribute name="Ignorable" type="xsd:string" />
+
+
+       <!-- Objective 2 -->
+
+       <xsd:attribute name="MustUnderstand" type="xsd:string" />
+       <xsd:attribute name="ProcessContent" type="xsd:string" />
+
+
+       <!-- An AlternateContent element shall contain one or more Choice child 
+               elements, optionally followed by a Fallback child element. If present, there 
+               shall be only one Fallback element, and it shall follow all Choice elements. -->
+       <xsd:element name="AlternateContent">
+               <xsd:complexType>
+                       <xsd:sequence>
+                               <xsd:element name="Choice" minOccurs="0" maxOccurs="unbounded">
+                                       <xsd:complexType>
+                                               <xsd:sequence>
+                                                       <xsd:any minOccurs="0" maxOccurs="unbounded"
+                                                               processContents="strict">
+                                                       </xsd:any>
+                                               </xsd:sequence>
+                                               <xsd:attribute name="Requires" type="xsd:string"
+                                                       use="required" />
+                                               <xsd:attribute ref="mc:Ignorable" use="optional" />
+                                               <xsd:attribute ref="mc:MustUnderstand" use="optional" />
+                                               <xsd:attribute ref="mc:ProcessContent" use="optional" />
+                                       </xsd:complexType>
+                               </xsd:element>
+                               <xsd:element name="Fallback" minOccurs="0" maxOccurs="1">
+                                       <xsd:complexType>
+                                               <xsd:sequence>
+                                                       <xsd:any minOccurs="0" maxOccurs="unbounded"
+                                                               processContents="strict">
+                                                       </xsd:any>
+                                               </xsd:sequence>
+                                               <xsd:attribute ref="mc:Ignorable" use="optional" />
+                                               <xsd:attribute ref="mc:MustUnderstand" use="optional" />
+                                               <xsd:attribute ref="mc:ProcessContent" use="optional" />
+                                       </xsd:complexType>
+                               </xsd:element>
+                       </xsd:sequence>
+                       <!-- AlternateContent elements might include the attributes Ignorable, 
+                               MustUnderstand and ProcessContent described in this Part of ECMA-376. These 
+                               attributes’ qualified names shall be prefixed when associated with an AlternateContent 
+                               element. -->
+                       <xsd:attribute ref="mc:Ignorable" use="optional" />
+                       <xsd:attribute ref="mc:MustUnderstand" use="optional" />
+                       <xsd:attribute ref="mc:ProcessContent" use="optional" />
+               </xsd:complexType>
+       </xsd:element>
+
+
+</xsd:schema>
\ No newline at end of file
index 3121e451d70bbb72f50160d74d8c155b65e26a67..19d48ab0ff31821e05a7c11bd38a2b5244bd0e2e 100644 (file)
@@ -39,4 +39,8 @@
     <xb:package>com.microsoft.schemas.vml</xb:package>\r
   </xb:namespace>\r
 \r
+  <xb:namespace uri="http://schemas.openxmlformats.org/markup-compatibility/2006">\r
+    <xb:package>com.microsoft.schemas.compatibility</xb:package>\r
+  </xb:namespace>\r
+\r
 </xb:config>
\ No newline at end of file