diff --git a/src/main/java/com/adobe/epubcheck/ops/OPSChecker.java b/src/main/java/com/adobe/epubcheck/ops/OPSChecker.java index bde30aa04..876ec120c 100755 --- a/src/main/java/com/adobe/epubcheck/ops/OPSChecker.java +++ b/src/main/java/com/adobe/epubcheck/ops/OPSChecker.java @@ -56,11 +56,11 @@ public class OPSChecker extends PublicationResourceChecker .putAll(Predicates.and(mimetype("application/xhtml+xml"), version(EPUBVersion.VERSION_2)), XMLValidators.XHTML_20_NVDL, XMLValidators.XHTML_20_SCH, XMLValidators.IDUNIQUE_20_SCH) .putAll(Predicates.and(mimetype("application/xhtml+xml"), version(EPUBVersion.VERSION_3)), - XMLValidators.XHTML_30_RNC, XMLValidators.XHTML_30_SCH) + XMLValidators.XHTML_30_RNC, XMLValidators.XHTML_30_SCH, XMLValidators.SVG_INFORMATIVE_30_NVDL) .putAll(Predicates.and(mimetype("image/svg+xml"), version(EPUBVersion.VERSION_2)), XMLValidators.SVG_20_NVDL, XMLValidators.IDUNIQUE_20_SCH) .putAll(Predicates.and(mimetype("image/svg+xml"), version(EPUBVersion.VERSION_3)), - XMLValidators.SVG_30_NVDL) + XMLValidators.SVG_30_NVDL, XMLValidators.SVG_INFORMATIVE_30_NVDL) .putAll( and(or(profile(EPUBProfile.DICT), hasPubType(OPFData.DC_TYPE_DICT)), mimetype("application/xhtml+xml"), version(EPUBVersion.VERSION_3)), diff --git a/src/main/java/com/adobe/epubcheck/xml/XMLValidators.java b/src/main/java/com/adobe/epubcheck/xml/XMLValidators.java index 5ec15827e..eb5ffe330 100644 --- a/src/main/java/com/adobe/epubcheck/xml/XMLValidators.java +++ b/src/main/java/com/adobe/epubcheck/xml/XMLValidators.java @@ -39,6 +39,7 @@ public enum XMLValidators SVG_20_NVDL("schema/20/rng/ops20-svg.nvdl"), SVG_30_RNC("schema/30/epub-svg-30.rnc"), SVG_30_NVDL("schema/30/epub-svg-30.nvdl"), + SVG_INFORMATIVE_30_NVDL("schema/30/epub-svg-informative.nvdl", false), SVG_30_SCH("schema/30/epub-svg-30.sch"), XHTML_20_NVDL("schema/20/rng/ops20.nvdl"), XHTML_20_SCH("schema/20/sch/xhtml.sch"), diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-informative.nvdl b/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-informative.nvdl new file mode 100644 index 000000000..a42863d44 --- /dev/null +++ b/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-informative.nvdl @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-informative.rnc b/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-informative.rnc new file mode 100644 index 000000000..06db5f9cc --- /dev/null +++ b/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-informative.rnc @@ -0,0 +1,30 @@ +namespace svg = "http://www.w3.org/2000/svg" + +include "./mod/epub-xhtml.rnc" { + # This schema applies both to XHTML and SVG documents + start = svg | html.elem +} +include "./mod/svg11/svg11-inc.rnc" { + # ID datatype is set here to the lower HTML requirements, + # proper checking is done by the normative schema + SVG.id.attrib = attribute id { datatype.html5.token }? +} +include "./mod/svg11/inkscape.rnc" + +## EPUB-specific additions: + +SVG.Core.attrib &= aria.global? +SVG.Core.extra.attrib &= epub.type.attr? + +## Do not check restricted elements, they are checked in normative schemas +SVG.foreignObject.content |= any.content +SVG.title.content |= any.content + +## Anything + +## Any attribute from any namespace, other than the special cases +any.attr = attribute * { text }* +## Any element from any namespace, other than the special cases +any.elem = element * { any.content & any.attr } +## Any content from any namespace +any.content = text & any.elem* \ No newline at end of file diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/epub30-catalog.xml b/src/main/resources/com/adobe/epubcheck/schema/30/epub30-catalog.xml index 0ad3c153f..3eb7e6095 100644 --- a/src/main/resources/com/adobe/epubcheck/schema/30/epub30-catalog.xml +++ b/src/main/resources/com/adobe/epubcheck/schema/30/epub30-catalog.xml @@ -18,6 +18,12 @@ + + + + diff --git a/src/test/resources/epub3/content-document-xhtml.feature b/src/test/resources/epub3/content-document-xhtml.feature index c1630a6e7..9b85bd390 100644 --- a/src/test/resources/epub3/content-document-xhtml.feature +++ b/src/test/resources/epub3/content-document-xhtml.feature @@ -724,8 +724,8 @@ Feature: EPUB 3 ▸ Content Documents ▸ XHTML Document Checks Scenario: Verify that SVG validation erors are reported as USAGE Given the reporting level set to usage When checking document 'svg-invalid-usage.xhtml' - #Then usage SVG-000 is reported - #And the message contains 'element "foo" not allowed here' + Then usage RSC-025 is reported + And the message contains 'element "foo" not allowed here' And no other errors or warnings are reported #TODO review if this warning is relevant