Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ODF1.4 support to validator. #334

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions validator/src/main/java/org/odftoolkit/odfvalidator/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ public static void main(String[] aArgs) {
} else if (aArg.equals("-1.0")
|| aArg.equals("-1.1")
|| aArg.equals("-1.2")
|| aArg.equals("-1.3")) {
|| aArg.equals("-1.3")
|| aArg.equals("-1.4")) {
aVersion = OdfVersion.valueOf(aArg.substring(1), false);
} else if (aArg.startsWith("-")) {
System.err.print(aArg);
Expand Down Expand Up @@ -245,7 +246,7 @@ public static void main(String[] aArgs) {
private static void printUsage() {
System.out.println("usage: odfvalidator -g <odffiles>");
System.out.println(
" odfvalidator [-r] [-c|-e|-s] [-d] [-v|-w] [-f <filterfile>] [-x <regexp>] [-o outputfile] [-1.0|-1.1|-1.2|1.3] <odffiles>");
" odfvalidator [-r] [-c|-e|-s] [-d] [-v|-w] [-f <filterfile>] [-x <regexp>] [-o outputfile] [-1.0|-1.1|-1.2|1.3|1.4] <odffiles>");
System.out.println(
" odfvalidator [-r] [-c|-e|-s] [-d] [-v|-w] [-f <filterfile>] [-x <regexp>] [-o outputfile] -S <schemafile> <odffiles>");
System.out.println(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ private Configuration getConfiguration(OdfVersion aVersion) throws ODFValidatorE
String aConfigName = null;
if (aVersion == null || aVersion == OdfVersion.V1_3) {
aConfigName = "/schema/odf1_3.properties";
} else if (aVersion == OdfVersion.V1_4) {
aConfigName = "/schema/odf1_4.properties";
} else if (aVersion == OdfVersion.V1_2) {
aConfigName = "/schema/odf1_2.properties";
} else if (aVersion == OdfVersion.V1_1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public enum OdfVersion {
V1_0("1.0"),
V1_1("1.1"),
V1_2("1.2"),
V1_3("1.3");
V1_3("1.3"),
V1_4("1.4");

private String m_aValue;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Open Document Format for Office Applications (OpenDocument) Version 1.4
OASIS Standard
11 March 2024
Copyright (c) OASIS Open 2024. All Rights Reserved.
Source: https://docs.oasis-open.org/office/OpenDocument/v1.4/csd01/schemas/
Latest stage of specification: https://docs.oasis-open.org/office/OpenDocument/v1.4/OpenDocument-v1.4-part1-introduction.html
TC IPR Statement: https://www.oasis-open.org/committees/office/ipr.php

Open Document Format for Office Applications (OpenDocument) Version 1.4
Digital Signatures Relax-NG Schema
OpenDocument-v1.4-dsig-schema.rng
-->
<!-- https://issues.oasis-open.org/browse/OFFICE-2153 -->

<rng:grammar xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:dsig="urn:oasis:names:tc:opendocument:xmlns:digitalsignature:1.0" xmlns:rng="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<rng:start>
<rng:choice>
<rng:ref name="dsig-document-signatures"/>
</rng:choice>
</rng:start>
<rng:define name="ds-signature">
<rng:element name="ds:Signature">
<!-- The permitted content of this element is the permitted -->
<!-- content of the Signature element defined by W3C XML -->
<!-- Signature Syntax and Processing (Second Edition). -->
<!-- See OpenDocument v1.4 part 2, section 5.3. -->
<!-- Office-3874 -->
<rng:ref name="dsMarkup"/>
</rng:element>
</rng:define>
<rng:define name="dsMarkup">
<rng:zeroOrMore>
<rng:choice>
<rng:attribute>
<rng:anyName/>
</rng:attribute>
<rng:text/>
<rng:element>
<rng:anyName/>
<rng:ref name="dsMarkup"/>
</rng:element>
</rng:choice>
</rng:zeroOrMore>
</rng:define>
<rng:define name="dsig-document-signatures">
<rng:element name="dsig:document-signatures">
<rng:ref name="dsig-document-signatures-attlist"/>
<rng:oneOrMore>
<rng:ref name="ds-signature"/>
</rng:oneOrMore>
</rng:element>
</rng:define>
<rng:define name="dsig-document-signatures-attlist">
<rng:attribute name="dsig:version">
<rng:value>1.4</rng:value>
</rng:attribute>
</rng:define>
</rng:grammar>
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Open Document Format for Office Applications (OpenDocument) Version 1.4
OASIS Standard
11 March 2024
Copyright (c) OASIS Open 2024. All Rights Reserved.
Source: https://docs.oasis-open.org/office/OpenDocument/v1.4/csd01/schemas/
Latest stage of specification: https://docs.oasis-open.org/office/OpenDocument/v1.4/OpenDocument-v1.4-part1-introduction.html
TC IPR Statement: https://www.oasis-open.org/committees/office/ipr.php

Open Document Format for Office Applications (OpenDocument) Version 1.4
Manifest Relax-NG Schema
OpenDocument-v1.4-manifest-schema.rng
-->
<!-- https://issues.oasis-open.org/browse/OFFICE-2153 -->

<rng:grammar xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0" xmlns:rng="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<rng:start>
<rng:choice>
<rng:ref name="manifest"/>
</rng:choice>
</rng:start>
<rng:define name="algorithm">
<rng:element name="manifest:algorithm">
<rng:ref name="algorithm-attlist"/>
<rng:ref name="anyElements"/>
</rng:element>
</rng:define>
<rng:define name="algorithm-attlist">
<rng:interleave>
<rng:attribute name="manifest:algorithm-name">
<rng:choice>
<rng:value>Blowfish CFB</rng:value>
<rng:ref name="anyURI"/>
</rng:choice>
</rng:attribute>
<rng:attribute name="manifest:initialisation-vector">
<rng:ref name="base64Binary"/>
</rng:attribute>
</rng:interleave>
</rng:define>
<rng:define name="anyAttListOrElements">
<rng:zeroOrMore>
<rng:attribute>
<rng:anyName/>
<rng:text/>
</rng:attribute>
</rng:zeroOrMore>
<rng:ref name="anyElements"/>
</rng:define>
<rng:define name="anyElements">
<rng:zeroOrMore>
<rng:element>
<rng:anyName/>
<rng:mixed>
<rng:ref name="anyAttListOrElements"/>
</rng:mixed>
</rng:element>
</rng:zeroOrMore>
</rng:define>
<rng:define name="anyURI">
<rng:data type="anyURI"/>
</rng:define>
<rng:define name="base64Binary">
<rng:data type="base64Binary"/>
</rng:define>
<rng:define name="encrypted-key">
<rng:element name="manifest:encrypted-key">
<rng:optional>
<rng:element name="manifest:encryption-method">
<rng:attribute name="manifest:PGPAlgorithm">
<rng:ref name="anyURI"/>
</rng:attribute>
</rng:element>
</rng:optional>
<rng:element name="manifest:keyinfo">
<rng:element name="manifest:PGPData">
<rng:element name="manifest:PGPKeyID">
<rng:ref name="base64Binary"/>
</rng:element>
<rng:optional>
<rng:element name="manifest:PGPKeyPacket">
<rng:ref name="base64Binary"/>
</rng:element>
</rng:optional>
</rng:element>
</rng:element>
<rng:element name="manifest:CipherData">
<rng:element name="manifest:CipherValue">
<rng:ref name="base64Binary"/>
</rng:element>
</rng:element>
</rng:element>
</rng:define>
<rng:define name="encryption-data">
<rng:element name="manifest:encryption-data">
<rng:ref name="encryption-data-attlist"/>
<rng:ref name="algorithm"/>
<rng:optional>
<rng:ref name="start-key-generation"/>
</rng:optional>
<rng:ref name="key-derivation"/>
</rng:element>
</rng:define>
<rng:define name="encryption-data-attlist">
<rng:interleave>
<rng:attribute name="manifest:checksum-type">
<rng:choice>
<rng:value>SHA1/1K</rng:value>
<rng:ref name="anyURI"/>
</rng:choice>
</rng:attribute>
<rng:attribute name="manifest:checksum">
<rng:ref name="base64Binary"/>
</rng:attribute>
</rng:interleave>
</rng:define>
<rng:define name="file-entry">
<rng:element name="manifest:file-entry">
<rng:ref name="file-entry-attlist"/>
<rng:optional>
<rng:ref name="encryption-data"/>
</rng:optional>
</rng:element>
</rng:define>
<rng:define name="file-entry-attlist">
<rng:interleave>
<rng:attribute name="manifest:full-path">
<rng:ref name="string"/>
</rng:attribute>
<rng:optional>
<rng:attribute name="manifest:size">
<rng:ref name="nonNegativeInteger"/>
</rng:attribute>
</rng:optional>
<rng:attribute name="manifest:media-type">
<rng:ref name="string"/>
</rng:attribute>
<rng:optional>
<rng:attribute name="manifest:preferred-view-mode">
<rng:choice>
<rng:value>edit</rng:value>
<rng:value>presentation-slide-show</rng:value>
<rng:value>read-only</rng:value>
<rng:ref name="namespacedToken"/>
</rng:choice>
</rng:attribute>
</rng:optional>
<rng:optional>
<rng:attribute name="manifest:version">
<rng:ref name="string"/>
</rng:attribute>
</rng:optional>
</rng:interleave>
</rng:define>
<rng:define name="key-derivation">
<rng:element name="manifest:key-derivation">
<rng:ref name="key-derivation-attlist"/>
<rng:empty/>
</rng:element>
</rng:define>
<rng:define name="key-derivation-attlist">
<rng:choice>
<rng:attribute name="manifest:key-derivation-name">
<rng:value>PGP</rng:value>
</rng:attribute>
<rng:interleave>
<rng:attribute name="manifest:key-derivation-name">
<rng:choice>
<rng:value>PBKDF2</rng:value>
<rng:ref name="anyURI"/>
</rng:choice>
</rng:attribute>
<rng:attribute name="manifest:salt">
<rng:ref name="base64Binary"/>
</rng:attribute>
<rng:attribute name="manifest:iteration-count">
<rng:ref name="nonNegativeInteger"/>
</rng:attribute>
<rng:optional>
<rng:attribute name="manifest:key-size">
<rng:ref name="nonNegativeInteger"/>
</rng:attribute>
</rng:optional>
</rng:interleave>
</rng:choice>
</rng:define>
<rng:define name="manifest">
<rng:element name="manifest:manifest">
<rng:ref name="manifest-attlist"/>
<rng:zeroOrMore>
<rng:ref name="encrypted-key"/>
</rng:zeroOrMore>
<!-- https://issues.oasis-open.org/browse/OFFICE-3940 -->
<rng:oneOrMore>
<rng:ref name="file-entry"/>
</rng:oneOrMore>
</rng:element>
</rng:define>
<rng:define name="manifest-attlist">
<rng:attribute name="manifest:version">
<rng:value>1.4</rng:value>
</rng:attribute>
</rng:define>
<rng:define name="namespacedToken">
<rng:data type="QName">
<rng:param name="pattern">[^:]+:[^:]+</rng:param>
</rng:data>
</rng:define>
<rng:define name="nonNegativeInteger">
<rng:data type="nonNegativeInteger"/>
</rng:define>
<rng:define name="start-key-generation">
<rng:element name="manifest:start-key-generation">
<rng:ref name="start-key-generation-attlist"/>
<rng:empty/>
</rng:element>
</rng:define>
<rng:define name="start-key-generation-attlist">
<rng:interleave>
<rng:attribute name="manifest:start-key-generation-name">
<rng:choice>
<rng:value>SHA1</rng:value>
<rng:ref name="anyURI"/>
</rng:choice>
</rng:attribute>
<rng:optional>
<rng:attribute name="manifest:key-size">
<rng:ref name="nonNegativeInteger"/>
</rng:attribute>
</rng:optional>
</rng:interleave>
</rng:define>
<rng:define name="string">
<rng:data type="string"/>
</rng:define>
</rng:grammar>
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Open Document Format for Office Applications (OpenDocument) Version 1.4
OASIS Standard
11 March 2024
Copyright (c) OASIS Open 2024. All Rights Reserved.
Source: https://docs.oasis-open.org/office/OpenDocument/v1.4/csd01/schemas/
Latest stage of specification: https://docs.oasis-open.org/office/OpenDocument/v1.4/OpenDocument-v1.4-part1-introduction.html
TC IPR Statement: https://www.oasis-open.org/committees/office/ipr.php

Open Document Format for Office Applications (OpenDocument) Version 1.4
OWL Schema Metadata Manifest Description
OpenDocument-v1.4-metadata.owl
-->

<!-- https://issues.oasis-open.org/browse/OFFICE-2153 -->

<rdf:RDF xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:odf="http://docs.oasis-open.org/ns/office/1.2/meta/odf#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:pkg="http://docs.oasis-open.org/ns/office/1.2/meta/pkg#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/01/rdf-schema#">

<owl:Ontology rdf:about="http://docs.oasis-open.org/ns/office/1.2/meta/odf#">
<owl:imports rdf:resource="http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-package-metadata.owl"/>
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
<dc:title xml:lang="en">Open Document Schema Metadata Manifest Ontology</dc:title>
<label xml:lang="en">ODF Schema Metadata Manifest</label>
</owl:Ontology>

<owl:Class rdf:about="http://docs.oasis-open.org/ns/office/1.2/meta/odf#ContentFile">
<label xml:lang="en">The OpenDocument Content File</label>
<comment xml:lang="en">The unique content.xml from the root path of the document</comment>
<subClassOf rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/pkg#File"/>
</owl:Class>

<owl:Class rdf:about="http://docs.oasis-open.org/ns/office/1.2/meta/odf#StylesFile">
<label xml:lang="en">The OpenDocument Styles File</label>
<comment xml:lang="en">The unique styles.xml from the root path of the document</comment>
<subClassOf rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/pkg#File"/>
</owl:Class>

<owl:Class rdf:about="http://docs.oasis-open.org/ns/office/1.2/meta/odf#Element">
<label xml:lang="en">OpenDocument Package ODF XML Element</label>
<subClassOf rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/pkg#Element"/>
</owl:Class>

<owl:Class rdf:about="urn:oasis:names:tc:opendocument:xmlns:text:1.0meta-field">
<label xml:lang="en">OpenDocument Meta field Element</label>
<subClassOf rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/odf#Element"/>
</owl:Class>

<owl:DatatypeProperty rdf:about="http://docs.oasis-open.org/ns/office/1.2/meta/odf#prefix">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#FunctionalProperty"/>
<domain rdf:resource="urn:oasis:names:tc:opendocument:xmlns:text:1.0meta-field"/>
<range rdf:resource="http://www.w3.org/2001/XMLSchema-datatypes#string"/>
<label xml:lang="en">has prefix</label>
</owl:DatatypeProperty>

<owl:DatatypeProperty rdf:about="http://docs.oasis-open.org/ns/office/1.2/meta/odf#suffix">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#FunctionalProperty"/>
<domain rdf:resource="urn:oasis:names:tc:opendocument:xmlns:text:1.0meta-field"/>
<range rdf:resource="http://www.w3.org/2001/XMLSchema-datatypes#string"/>
<label xml:lang="en">has suffix</label>
</owl:DatatypeProperty>
</rdf:RDF>
Loading
Loading