Skip to content

Commit

Permalink
feat: update the XML ouput to the new JHOVE schema
Browse files Browse the repository at this point in the history
This new schema has been published and includes an 'id' attribute as
well as a `warning` level. So the alignment between the severity
attribute and the level is now straightforward.

EPUBCheck severity | JHOVE severity attribute
-------------------| ------------------
fatal error        | error
error              | error
warn               | warning
hint               | info

Fixes #789
  • Loading branch information
tledoux authored and rdeltour committed May 1, 2020
1 parent 22fa3b1 commit 0b346fd
Show file tree
Hide file tree
Showing 15 changed files with 237 additions and 237 deletions.
12 changes: 6 additions & 6 deletions src/main/java/com/adobe/epubcheck/util/XmlReportImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ public int generateReport()
generationDate = fromTime(System.currentTimeMillis());
try
{
setNamespace("http://hul.harvard.edu/ois/xml/ns/jhove");
setNamespace("http://schema.openpreservation.org/ois/xml/ns/jhove");
addPrefixNamespace("xsi","http://www.w3.org/2001/XMLSchema-instance");
List<KeyValue<String, String>> attrs = new ArrayList<KeyValue<String, String>>();
attrs.add(KeyValue.with("name", epubCheckName));
attrs.add(KeyValue.with("release", epubCheckVersion));
attrs.add(KeyValue.with("date", epubCheckDate));
attrs.add(KeyValue.with("xsi:schemaLocation", "http://hul.harvard.edu/ois/xml/ns/jhove http://hul.harvard.edu/ois/xml/xsd/jhove/jhove.xsd"));
attrs.add(KeyValue.with("xsi:schemaLocation", "http://schema.openpreservation.org/ois/xml/ns/jhove https://schema.openpreservation.org/ois/xml/xsd/jhove/jhove.xsd"));
startElement("jhove", attrs);

generateElement("date", generationDate);
Expand Down Expand Up @@ -69,7 +69,7 @@ public int generateReport()
loc = " (" + ml.getLine() + "-" + ml.getColumn() + ")";
}
generateElement("message", m + PathUtil.removeWorkingDirectory(ml.getPath()) + loc,
KeyValue.with("subMessage", c.getID()), KeyValue.with("severity", "error"));
KeyValue.with("id", c.getID()), KeyValue.with("severity", "error"));
}
}
for (CheckMessage c : errors) {
Expand All @@ -80,7 +80,7 @@ public int generateReport()
loc = " (" + ml.getLine() + "-" + ml.getColumn() + ")";
}
generateElement("message", m + PathUtil.removeWorkingDirectory(ml.getPath()) + loc,
KeyValue.with("subMessage", c.getID()), KeyValue.with("severity", "error"));
KeyValue.with("id", c.getID()), KeyValue.with("severity", "error"));
}
}
for (CheckMessage c : warns) {
Expand All @@ -91,7 +91,7 @@ public int generateReport()
loc = " (" + ml.getLine() + "-" + ml.getColumn() + ")";
}
generateElement("message", m + PathUtil.removeWorkingDirectory(ml.getPath()) + loc,
KeyValue.with("subMessage", c.getID()), KeyValue.with("severity", "error"));
KeyValue.with("id", c.getID()), KeyValue.with("severity", "warning"));
}
}
for (CheckMessage c : hints) {
Expand All @@ -102,7 +102,7 @@ public int generateReport()
loc = " (" + ml.getLine() + "-" + ml.getColumn() + ")";
}
generateElement("message", m + PathUtil.removeWorkingDirectory(ml.getPath()) + loc,
KeyValue.with("subMessage", c.getID()), KeyValue.with("severity", "info"));
KeyValue.with("id", c.getID()), KeyValue.with("severity", "info"));
}
}
endElement("messages");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<jhove xmlns="http://hul.harvard.edu/ois/xml/ns/jhove"
<jhove xmlns="http://schema.openpreservation.org/ois/xml/ns/jhove"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
date="2017-01-02"
name="epubcheck"
release="4.0.3-SNAPSHOT"
xsi:schemaLocation="http://hul.harvard.edu/ois/xml/ns/jhove http://hul.harvard.edu/ois/xml/xsd/jhove/jhove.xsd">
xsi:schemaLocation="http://schema.openpreservation.org/ois/xml/ns/jhove https://schema.openpreservation.org/ois/xml/xsd/jhove/jhove.xsd">
<date>2017-01-02T18:40:30+01:00</date>
<repInfo uri="/Users/tofi/dev/epubcheck/target/test-classes/com/adobe/epubcheck/test/DTBook/Basic.epub">
<created>2017-01-02T18:34:14Z</created>
<format>application/epub+zip</format>
<version>2.0.1</version>
<status>Well-formed</status>
<messages>
<message severity="error" subMessage="OPF-021">OPF-021, WARN, [Use of non-registered URI scheme type in href: 'waka://barnesandnoble.com'.], OPS/AreYouReadyV3.xml (25-69)</message>
<message severity="info" subMessage="HTM-010">HTM-010, HINT, [Namespace uri 'http://www.daisy.org/z3986/2005/ncx/' was found.], OPS/toc.ncx (2-68)</message>
<message severity="warning" id="OPF-021">OPF-021, WARN, [Use of non-registered URI scheme type in href: 'waka://barnesandnoble.com'.], OPS/AreYouReadyV3.xml (25-69)</message>
<message severity="info" id="HTM-010">HTM-010, HINT, [Namespace uri 'http://www.daisy.org/z3986/2005/ncx/' was found.], OPS/toc.ncx (2-68)</message>
</messages>
<mimeType>application/epub+zip</mimeType>
<properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<jhove xmlns="http://hul.harvard.edu/ois/xml/ns/jhove"
<jhove xmlns="http://schema.openpreservation.org/ois/xml/ns/jhove"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
date="2019-02-05"
name="epubcheck"
release="4.2.0-beta-SNAPSHOT"
xsi:schemaLocation="http://hul.harvard.edu/ois/xml/ns/jhove http://hul.harvard.edu/ois/xml/xsd/jhove/jhove.xsd">
xsi:schemaLocation="http://schema.openpreservation.org/ois/xml/ns/jhove https://schema.openpreservation.org/ois/xml/xsd/jhove/jhove.xsd">
<date>2019-02-05T15:38:26+01:00</date>
<repInfo uri="/Users/Romain/Work/epubcheck/epubcheck/target/test-classes/com/adobe/epubcheck/test/command_line/xmlfile.epub">
<created>2019-02-05T15:38:16Z</created>
Expand All @@ -13,17 +13,17 @@
<version>3.0.1</version>
<status>Well-formed</status>
<messages>
<message severity="info" subMessage="ACC-008">ACC-008, HINT, [Navigation Document has no 'landmarks nav' element.], OPS/toc.xhtml</message>
<message severity="info" subMessage="HTM-010">HTM-010, HINT, [Namespace uri 'http://www.daisy.org/z3986/2005/ncx/' was found.], OPS/toc.ncx (2-68)</message>
<message severity="info" subMessage="CSS-009">CSS-009, HINT, [Use of certain CSS such as Columns, Transforms, Transitions, box-sizing or KeyFrames can cause pagination issues.], OPS/style.css (3-23)</message>
<message severity="info" subMessage="CSS-009">CSS-009, HINT, [Use of certain CSS such as Columns, Transforms, Transitions, box-sizing or KeyFrames can cause pagination issues.], OPS/style.css (8-23)</message>
<message severity="info" subMessage="CSS-009">CSS-009, HINT, [Use of certain CSS such as Columns, Transforms, Transitions, box-sizing or KeyFrames can cause pagination issues.], OPS/style_tag_css.xhtml (8-31)</message>
<message severity="info" subMessage="CSS-009">CSS-009, HINT, [Use of certain CSS such as Columns, Transforms, Transitions, box-sizing or KeyFrames can cause pagination issues.], OPS/style_tag_css.xhtml (13-31)</message>
<message severity="info" subMessage="CSS-009">CSS-009, HINT, [Use of certain CSS such as Columns, Transforms, Transitions, box-sizing or KeyFrames can cause pagination issues.], OPS/style_tag_css.xhtml (5-28)</message>
<message severity="info" subMessage="ACC-013">ACC-013, HINT, [Content file contains at least one inline style declaration.], OPS/inline_css.xhtml (10-119)</message>
<message severity="info" subMessage="ACC-013">ACC-013, HINT, [Content file contains at least one inline style declaration.], OPS/inline_css.xhtml (11-115)</message>
<message severity="info" subMessage="ACC-013">ACC-013, HINT, [Content file contains at least one inline style declaration.], OPS/inline_css.xhtml (14-116)</message>
<message severity="info" subMessage="ACC-013">ACC-013, HINT, [Content file contains at least one inline style declaration.], OPS/inline_css.xhtml (15-114)</message>
<message severity="info" id="ACC-008">ACC-008, HINT, [Navigation Document has no 'landmarks nav' element.], OPS/toc.xhtml</message>
<message severity="info" id="HTM-010">HTM-010, HINT, [Namespace uri 'http://www.daisy.org/z3986/2005/ncx/' was found.], OPS/toc.ncx (2-68)</message>
<message severity="info" id="CSS-009">CSS-009, HINT, [Use of certain CSS such as Columns, Transforms, Transitions, box-sizing or KeyFrames can cause pagination issues.], OPS/style.css (3-23)</message>
<message severity="info" id="CSS-009">CSS-009, HINT, [Use of certain CSS such as Columns, Transforms, Transitions, box-sizing or KeyFrames can cause pagination issues.], OPS/style.css (8-23)</message>
<message severity="info" id="CSS-009">CSS-009, HINT, [Use of certain CSS such as Columns, Transforms, Transitions, box-sizing or KeyFrames can cause pagination issues.], OPS/style_tag_css.xhtml (8-31)</message>
<message severity="info" id="CSS-009">CSS-009, HINT, [Use of certain CSS such as Columns, Transforms, Transitions, box-sizing or KeyFrames can cause pagination issues.], OPS/style_tag_css.xhtml (13-31)</message>
<message severity="info" id="CSS-009">CSS-009, HINT, [Use of certain CSS such as Columns, Transforms, Transitions, box-sizing or KeyFrames can cause pagination issues.], OPS/style_tag_css.xhtml (5-28)</message>
<message severity="info" id="ACC-013">ACC-013, HINT, [Content file contains at least one inline style declaration.], OPS/inline_css.xhtml (10-119)</message>
<message severity="info" id="ACC-013">ACC-013, HINT, [Content file contains at least one inline style declaration.], OPS/inline_css.xhtml (11-115)</message>
<message severity="info" id="ACC-013">ACC-013, HINT, [Content file contains at least one inline style declaration.], OPS/inline_css.xhtml (14-116)</message>
<message severity="info" id="ACC-013">ACC-013, HINT, [Content file contains at least one inline style declaration.], OPS/inline_css.xhtml (15-114)</message>
</messages>
<mimeType>application/epub+zip</mimeType>
<properties>
Expand Down
Loading

0 comments on commit 0b346fd

Please sign in to comment.