Skip to content

Commit 0b346fd

Browse files
tledouxrdeltour
authored andcommitted
feat: update the XML ouput to the new JHOVE schema
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
1 parent 22fa3b1 commit 0b346fd

15 files changed

+237
-237
lines changed

src/main/java/com/adobe/epubcheck/util/XmlReportImpl.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ public int generateReport()
2626
generationDate = fromTime(System.currentTimeMillis());
2727
try
2828
{
29-
setNamespace("http://hul.harvard.edu/ois/xml/ns/jhove");
29+
setNamespace("http://schema.openpreservation.org/ois/xml/ns/jhove");
3030
addPrefixNamespace("xsi","http://www.w3.org/2001/XMLSchema-instance");
3131
List<KeyValue<String, String>> attrs = new ArrayList<KeyValue<String, String>>();
3232
attrs.add(KeyValue.with("name", epubCheckName));
3333
attrs.add(KeyValue.with("release", epubCheckVersion));
3434
attrs.add(KeyValue.with("date", epubCheckDate));
35-
attrs.add(KeyValue.with("xsi:schemaLocation", "http://hul.harvard.edu/ois/xml/ns/jhove http://hul.harvard.edu/ois/xml/xsd/jhove/jhove.xsd"));
35+
attrs.add(KeyValue.with("xsi:schemaLocation", "http://schema.openpreservation.org/ois/xml/ns/jhove https://schema.openpreservation.org/ois/xml/xsd/jhove/jhove.xsd"));
3636
startElement("jhove", attrs);
3737

3838
generateElement("date", generationDate);
@@ -69,7 +69,7 @@ public int generateReport()
6969
loc = " (" + ml.getLine() + "-" + ml.getColumn() + ")";
7070
}
7171
generateElement("message", m + PathUtil.removeWorkingDirectory(ml.getPath()) + loc,
72-
KeyValue.with("subMessage", c.getID()), KeyValue.with("severity", "error"));
72+
KeyValue.with("id", c.getID()), KeyValue.with("severity", "error"));
7373
}
7474
}
7575
for (CheckMessage c : errors) {
@@ -80,7 +80,7 @@ public int generateReport()
8080
loc = " (" + ml.getLine() + "-" + ml.getColumn() + ")";
8181
}
8282
generateElement("message", m + PathUtil.removeWorkingDirectory(ml.getPath()) + loc,
83-
KeyValue.with("subMessage", c.getID()), KeyValue.with("severity", "error"));
83+
KeyValue.with("id", c.getID()), KeyValue.with("severity", "error"));
8484
}
8585
}
8686
for (CheckMessage c : warns) {
@@ -91,7 +91,7 @@ public int generateReport()
9191
loc = " (" + ml.getLine() + "-" + ml.getColumn() + ")";
9292
}
9393
generateElement("message", m + PathUtil.removeWorkingDirectory(ml.getPath()) + loc,
94-
KeyValue.with("subMessage", c.getID()), KeyValue.with("severity", "error"));
94+
KeyValue.with("id", c.getID()), KeyValue.with("severity", "warning"));
9595
}
9696
}
9797
for (CheckMessage c : hints) {
@@ -102,7 +102,7 @@ public int generateReport()
102102
loc = " (" + ml.getLine() + "-" + ml.getColumn() + ")";
103103
}
104104
generateElement("message", m + PathUtil.removeWorkingDirectory(ml.getPath()) + loc,
105-
KeyValue.with("subMessage", c.getID()), KeyValue.with("severity", "info"));
105+
KeyValue.with("id", c.getID()), KeyValue.with("severity", "info"));
106106
}
107107
}
108108
endElement("messages");

src/test/resources/com/adobe/epubcheck/test/DTBook/Basic_expected_results.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<jhove xmlns="http://hul.harvard.edu/ois/xml/ns/jhove"
2+
<jhove xmlns="http://schema.openpreservation.org/ois/xml/ns/jhove"
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
date="2017-01-02"
55
name="epubcheck"
66
release="4.0.3-SNAPSHOT"
7-
xsi:schemaLocation="http://hul.harvard.edu/ois/xml/ns/jhove http://hul.harvard.edu/ois/xml/xsd/jhove/jhove.xsd">
7+
xsi:schemaLocation="http://schema.openpreservation.org/ois/xml/ns/jhove https://schema.openpreservation.org/ois/xml/xsd/jhove/jhove.xsd">
88
<date>2017-01-02T18:40:30+01:00</date>
99
<repInfo uri="/Users/tofi/dev/epubcheck/target/test-classes/com/adobe/epubcheck/test/DTBook/Basic.epub">
1010
<created>2017-01-02T18:34:14Z</created>
1111
<format>application/epub+zip</format>
1212
<version>2.0.1</version>
1313
<status>Well-formed</status>
1414
<messages>
15-
<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>
16-
<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>
15+
<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>
16+
<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>
1717
</messages>
1818
<mimeType>application/epub+zip</mimeType>
1919
<properties>

src/test/resources/com/adobe/epubcheck/test/command_line/xmlfile_expected_results.xml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<jhove xmlns="http://hul.harvard.edu/ois/xml/ns/jhove"
2+
<jhove xmlns="http://schema.openpreservation.org/ois/xml/ns/jhove"
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
date="2019-02-05"
55
name="epubcheck"
66
release="4.2.0-beta-SNAPSHOT"
7-
xsi:schemaLocation="http://hul.harvard.edu/ois/xml/ns/jhove http://hul.harvard.edu/ois/xml/xsd/jhove/jhove.xsd">
7+
xsi:schemaLocation="http://schema.openpreservation.org/ois/xml/ns/jhove https://schema.openpreservation.org/ois/xml/xsd/jhove/jhove.xsd">
88
<date>2019-02-05T15:38:26+01:00</date>
99
<repInfo uri="/Users/Romain/Work/epubcheck/epubcheck/target/test-classes/com/adobe/epubcheck/test/command_line/xmlfile.epub">
1010
<created>2019-02-05T15:38:16Z</created>
@@ -13,17 +13,17 @@
1313
<version>3.0.1</version>
1414
<status>Well-formed</status>
1515
<messages>
16-
<message severity="info" subMessage="ACC-008">ACC-008, HINT, [Navigation Document has no 'landmarks nav' element.], OPS/toc.xhtml</message>
17-
<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>
18-
<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>
19-
<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>
20-
<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>
21-
<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>
22-
<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>
23-
<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>
24-
<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>
25-
<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>
26-
<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>
16+
<message severity="info" id="ACC-008">ACC-008, HINT, [Navigation Document has no 'landmarks nav' element.], OPS/toc.xhtml</message>
17+
<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>
18+
<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>
19+
<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>
20+
<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>
21+
<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>
22+
<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>
23+
<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>
24+
<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>
25+
<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>
26+
<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>
2727
</messages>
2828
<mimeType>application/epub+zip</mimeType>
2929
<properties>

0 commit comments

Comments
 (0)