diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-30.nvdl b/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-30.nvdl
index 026d153a3..0bcd7caf2 100644
--- a/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-30.nvdl
+++ b/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-30.nvdl
@@ -4,7 +4,7 @@
-
+
@@ -29,23 +29,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-30.rnc b/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-30.rnc
index 87363bdf2..887e9b79d 100644
--- a/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-30.rnc
+++ b/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-30.rnc
@@ -1 +1,17 @@
-include "./mod/epub-svg11.rnc"
+namespace svg = "http://www.w3.org/2000/svg"
+
+include "./mod/epub-xhtml.rnc" {
+ start = svg
+}
+include "./mod/epub-mathml3.rnc"
+include "./mod/epub-svg-inc.rnc"
+
+svg.title.content |= common.elem.phrasing
+
+svg.foreignObject.content |=
+ ( body.elem
+ | common.inner.flow
+ | math
+ )
+
+mtext.content |= common.elem.phrasing
\ No newline at end of file
diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-30.sch b/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-30.sch
index 10ad603a4..0804a324f 100644
--- a/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-30.sch
+++ b/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-30.sch
@@ -1,11 +1,7 @@
-
-
-
-
diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/epub-xhtml-30.rnc b/src/main/resources/com/adobe/epubcheck/schema/30/epub-xhtml-30.rnc
index acbe1a6aa..8a3368292 100644
--- a/src/main/resources/com/adobe/epubcheck/schema/30/epub-xhtml-30.rnc
+++ b/src/main/resources/com/adobe/epubcheck/schema/30/epub-xhtml-30.rnc
@@ -1,7 +1,17 @@
-## XHTML5
+namespace svg = "http://www.w3.org/2000/svg"
+
include "./mod/epub-xhtml.rnc"
+include "./mod/epub-mathml3.rnc"
+include "./mod/epub-svg-inc.rnc" {
+ svg.attr.id = attribute id { datatype.html5.token }?
+}
+
+common.elem.phrasing |= svg
+common.elem.phrasing |= math
-## SVG and MathML
+svg.title.content |= common.elem.phrasing
-include "./mod/epub-xhtml-mathml3.rnc"
-include "./mod/epub-xhtml-svg11.rnc"
+svg.foreignObject.content |=
+ ( common.inner.flow
+ | math
+ )
diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/epub-xhtml-30.sch b/src/main/resources/com/adobe/epubcheck/schema/30/epub-xhtml-30.sch
index 40d0213ec..5cae1670d 100644
--- a/src/main/resources/com/adobe/epubcheck/schema/30/epub-xhtml-30.sch
+++ b/src/main/resources/com/adobe/epubcheck/schema/30/epub-xhtml-30.sch
@@ -402,6 +402,4 @@
-
-
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 c0916fb8f..0ad3c153f 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
@@ -52,13 +52,9 @@
uri="mod/epub-ssml-attrs.rnc"/>
-
-
-
-
-
+
+
diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/mod/epub-svg-inc.rnc b/src/main/resources/com/adobe/epubcheck/schema/30/mod/epub-svg-inc.rnc
new file mode 100644
index 000000000..eac862938
--- /dev/null
+++ b/src/main/resources/com/adobe/epubcheck/schema/30/mod/epub-svg-inc.rnc
@@ -0,0 +1,39 @@
+default namespace = "http://www.w3.org/2000/svg"
+
+# #####################################################################
+## Anything-goes schema for svg #
+# #####################################################################
+
+## SVG root
+svg = svg.elem
+svg.elem =
+ element svg { any.content & any.attr }
+
+## Special cases
+specific.elems =
+ ( svg.foreignObject
+ | svg.title
+ )
+specific.attrs = svg.attr.id
+
+### SVG ID datatype
+svg.attr.id = attribute id { xsd:ID }?
+
+### SVG foreignObject element restrictions
+svg.foreignObject =
+ element foreignObject { any.attr & svg.foreignObject.content }
+svg.foreignObject.content = notAllowed
+
+### SVG title element restrictions
+svg.title =
+ element title { any.attr & svg.title.content }
+svg.title.content = text
+
+## Anything
+
+## Any attribute from any namespace, other than the special cases
+any.attr = attribute * -id { text }* & svg.attr.id
+## Any element from any namespace, other than the special cases
+any.elem = element * - (foreignObject|title) { any.content & any.attr }
+## Any content from any namespace
+any.content = text & any.elem* & specific.elems*
diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/mod/epub-svg11-re.sch b/src/main/resources/com/adobe/epubcheck/schema/30/mod/epub-svg11-re.sch
deleted file mode 100644
index 223d39ab4..000000000
--- a/src/main/resources/com/adobe/epubcheck/schema/30/mod/epub-svg11-re.sch
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
- Invalid value (expecting: "http://www.idpf.org/2007/ops")
-
-
\ No newline at end of file
diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/mod/epub-svg11.rnc b/src/main/resources/com/adobe/epubcheck/schema/30/mod/epub-svg11.rnc
deleted file mode 100644
index 56e5cb1aa..000000000
--- a/src/main/resources/com/adobe/epubcheck/schema/30/mod/epub-svg11.rnc
+++ /dev/null
@@ -1,40 +0,0 @@
-# Credit: integration adapted from the Nu Html Checker drivers
-
-namespace svg = "http://www.w3.org/2000/svg"
-namespace math = "http://www.w3.org/1998/Math/MathML"
-namespace rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-
-include "epub-xhtml.rnc" {
- start = svg
-}
-include "svg11/svg11-inc.rnc"
-include "svg11/inkscape.rnc"
-
-include "epub-mathml3.rnc"
-
-common.elem.phrasing |= svg
-
-common.elem.phrasing |= math
-
-SVG.foreignObject.content |=
- ( math
- | html.elem
- | body.elem
- | common.inner.flow
- )
-
-SVG.Core.attrib &= aria.global?
-SVG.Core.extra.attrib &= epub.type.attr?
-
-# augment MathML annotation-xml content model
-# annotation-xml.model.svg |= svg
-# annotation-xml.model.xhtml |=
-# ( html.elem
-# | common.elem.flow
-# )
-
-# in our integration, is the only MathML "token element" that can
-# contain HTML element content; the , , and elements
-# cannot; see http://www.w3.org/Bugs/Public/show_bug.cgi?id=9859#c8 for a
-# rationale
-mtext.content |= common.elem.phrasing
diff --git a/src/test/resources/epub3/content-document-svg.feature b/src/test/resources/epub3/content-document-svg.feature
index c41d4f778..fff944a69 100644
--- a/src/test/resources/epub3/content-document-svg.feature
+++ b/src/test/resources/epub3/content-document-svg.feature
@@ -19,7 +19,7 @@ Feature: EPUB 3 ▸ Content Documents ▸ SVG Document Checks
## 3.2 Content Conformance
### ARIA attributes
-
+
Scenario: Verify ARIA attributes are allowed
When checking document 'aria-attributes-valid.svg'
Then no errors or warnings are reported
@@ -65,6 +65,12 @@ Feature: EPUB 3 ▸ Content Documents ▸ SVG Document Checks
And the message contains 'Duplicate'
And no other errors or warnings are reported
+ Scenario: Report invalid `id` attribute values
+ When checking document 'id-invalid-error.svg'
+ Then error RSC-005 is reported
+ And the message contains '"id" is invalid'
+ And no other errors or warnings are reported
+
### Style Attribute
Scenario: Verify `style` element without explicit `type` (issue 688)
@@ -84,20 +90,51 @@ Feature: EPUB 3 ▸ Content Documents ▸ SVG Document Checks
When checking document 'foreignObject-valid.svg'
Then no errors or warnings are reported
- Scenario: Report `foreignObject` with a `requiredExtensions` attribute with a non-OPS namespace
- When checking document 'foreignObject-requiredExtensions-ns-error.svg'
+ Scenario: Verify that the `requiredExtensions` attribute can have any value
+ Note: 'requiredExensions' was required to be set to 'http://www.idpf.org/2007/ops' in EPUB 3.2 and earlier versions
+ When checking document 'foreignObject-requiredExtensions-valid.svg'
+ Then no errors or warnings are reported
+
+ Scenario: Report `foreignObject` with non-HTML child content
+ When checking document 'foreignObject-not-html-error.svg'
Then error RSC-005 is reported
- And the message contains 'Invalid value (expecting: "http://www.idpf.org/2007/ops")'
+ And the message contains 'element "foo" not allowed here'
And no other errors or warnings are reported
-
- Scenario: Report `foreignObject` with non-HTML child content
- When checking document 'foreignObject-non-html-content-error.svg'
+
+ Scenario: Report `foreignObject` with non-flow content
+ When checking document 'foreignObject-not-flow-content-error.svg'
Then error RSC-005 is reported
- And the message contains 'elements from namespace "https://example.org" are not allowed'
+ And the message contains 'element "title" not allowed here'
And no other errors or warnings are reported
-
+
Scenario: Report `foreignObject` with multiple HTML `body` elements
When checking document 'foreignObject-multiple-body-error.svg'
Then error RSC-005 is reported
- And the message contains 'element "h:body" not allowed here'
+ And the message contains 'element "body" not allowed here'
+ And no other errors or warnings are reported
+
+ Scenario: Report HTML validation errors within `foreignObject` content
+ When checking document 'foreignObject-html-invalid-error.svg'
+ Then error RSC-005 is reported
+ And the message contains 'attribute "href" not allowed here'
+ And no other errors or warnings are reported
+
+ Scenario: Verify `title` can contain text
+ When checking document 'title-text-valid.svg'
+ Then no errors or warnings are reported
+
+ Scenario: Verify `title` can contain HTML phrasing content
+ When checking document 'title-phrasing-content-valid.svg'
+ Then no errors or warnings are reported
+
+ Scenario: Report `title` with non-phrasing content
+ When checking document 'title-not-phrasing-content-error.svg'
+ Then error RSC-005 is reported
+ And the message contains 'element "h1" not allowed here'
+ And no other errors or warnings are reported
+
+ Scenario: Report HTML validation errors within `title` content
+ When checking document 'title-html-invalid-error.svg'
+ Then error RSC-005 is reported
+ And the message contains 'attribute "href" not allowed here'
And no other errors or warnings are reported
diff --git a/src/test/resources/epub3/content-document-xhtml.feature b/src/test/resources/epub3/content-document-xhtml.feature
index b233eec86..c1630a6e7 100644
--- a/src/test/resources/epub3/content-document-xhtml.feature
+++ b/src/test/resources/epub3/content-document-xhtml.feature
@@ -710,26 +710,25 @@ Feature: EPUB 3 ▸ Content Documents ▸ XHTML Document Checks
When checking document 'svg-valid.xhtml'
Then no errors or warnings are reported
+ Scenario: Verify conforming SVG markup does not create false-positives
+ When checking document 'svg-regression-valid.xhtml'
+ Then no errors or warnings are reported
+ Scenario: Verify the SVG IDs can be any valid HTML ID
+ When checking document 'svg-id-valid.xhtml'
+ Then no errors or warnings are reported
+
Scenario: Verify that `epub:type` attribute can be used on SVG
When checking document 'svg-with-epubtype-valid.xhtml'
Then no errors or warnings are reported
- Scenario: Report SVG with invalid content model
- When checking document 'svg-error.xhtml'
- Then error RSC-005 is reported
- And the message contains 'The svg element must not appear inside title elements'
- And no other errors or warnings are reported
-
- Scenario: Report SVG with incorrect `requiredExtensions` attribute value
- When checking document 'svg-requiredExtensions-error.xhtml'
- Then error RSC-005 is reported
- And the message contains 'Invalid value (expecting: "http://www.idpf.org/2007/ops")'
+ 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'
And no other errors or warnings are reported
- Scenario: Verify `xlink:href` allowed on SVG elements
- When checking document 'svg-links-valid.xhtml'
- Then no errors or warnings are reported
-
+ #TODO review if this warning is relevant
Scenario: Report an SVG link without a recommended title
When checking document 'svg-links-no-title-warning.xhtml'
Then warning ACC-011 is reported
@@ -739,19 +738,48 @@ Feature: EPUB 3 ▸ Content Documents ▸ XHTML Document Checks
When checking document 'svg-foreignObject-valid.xhtml'
Then no errors or warnings are reported
- Scenario: Report `foreignObject` with disallowed body element
+ Scenario: Verify that the `requiredExtensions` attribute can have any value
+ When checking document 'svg-foreignObject-requiredExtensions-valid.xhtml'
+ And no other errors or warnings are reported
+
+ Scenario: Report `foreignObject` with a body element
When checking document 'svg-foreignObject-with-body-error.xhtml'
Then error RSC-005 is reported
And the message contains 'element "body" not allowed here'
And no other errors or warnings are reported
+
+ Scenario: Report HTML validation errors within `foreignObject` content
+ When checking document 'svg-foreignObject-html-invalid-error.xhtml'
+ Then error RSC-005 is reported
+ And the message contains 'attribute "href" not allowed here'
+ And no other errors or warnings are reported
Scenario: Report `foreignObject` without flow content
- When checking document 'svg-foreignObject-no-flow-error.xhtml'
+ When checking document 'svg-foreignObject-not-flow-content-error.xhtml'
Then error RSC-005 is reported
And the message contains 'element "title" not allowed here'
And no other errors or warnings are reported
-# Still not allowed by epubcheck - https://github.com/w3c/epubcheck/issues/173
-# Scenario: Verify RDF elements can be embedded in SVG
-# When checking document 'svg-rdf-valid.xhtml'
-# Then no errors or warnings are reported
+ Scenario: Verify `title` can contain text
+ When checking document 'svg-title-text-valid.xhtml'
+ Then no errors or warnings are reported
+
+ Scenario: Verify `title` can contain HTML phrasing content
+ When checking document 'svg-title-phrasing-content-valid.xhtml'
+ Then no errors or warnings are reported
+
+ Scenario: Report `title` with non-phrasing content
+ When checking document 'svg-title-not-phrasing-content-error.xhtml'
+ Then error RSC-005 is reported
+ And the message contains 'element "h1" not allowed here'
+ And no other errors or warnings are reported
+
+ Scenario: Report HTML validation errors within `title` content
+ When checking document 'svg-title-html-invalid-error.xhtml'
+ Then error RSC-005 is reported
+ And the message contains 'attribute "href" not allowed here'
+ And no other errors or warnings are reported
+
+ Scenario: Verify RDF elements can be embedded in SVG
+ When checking document 'svg-rdf-valid.xhtml'
+ Then no errors or warnings are reported
diff --git a/src/test/resources/epub3/files/content-document-svg/foreignObject-html-invalid-error.svg b/src/test/resources/epub3/files/content-document-svg/foreignObject-html-invalid-error.svg
new file mode 100644
index 000000000..35c750d5d
--- /dev/null
+++ b/src/test/resources/epub3/files/content-document-svg/foreignObject-html-invalid-error.svg
@@ -0,0 +1,13 @@
+
+
diff --git a/src/test/resources/epub3/files/content-document-svg/foreignObject-multiple-body-error.svg b/src/test/resources/epub3/files/content-document-svg/foreignObject-multiple-body-error.svg
index 31fdbe346..e3d87793c 100644
--- a/src/test/resources/epub3/files/content-document-svg/foreignObject-multiple-body-error.svg
+++ b/src/test/resources/epub3/files/content-document-svg/foreignObject-multiple-body-error.svg
@@ -1,11 +1,16 @@
diff --git a/src/test/resources/epub3/files/content-document-svg/foreignObject-non-html-content-error.svg b/src/test/resources/epub3/files/content-document-svg/foreignObject-non-html-content-error.svg
deleted file mode 100644
index c72aaec1d..000000000
--- a/src/test/resources/epub3/files/content-document-svg/foreignObject-non-html-content-error.svg
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
diff --git a/src/test/resources/epub3/files/content-document-svg/foreignObject-not-flow-content-error.svg b/src/test/resources/epub3/files/content-document-svg/foreignObject-not-flow-content-error.svg
new file mode 100644
index 000000000..769e49598
--- /dev/null
+++ b/src/test/resources/epub3/files/content-document-svg/foreignObject-not-flow-content-error.svg
@@ -0,0 +1,13 @@
+
+
diff --git a/src/test/resources/epub3/files/content-document-svg/foreignObject-not-html-error.svg b/src/test/resources/epub3/files/content-document-svg/foreignObject-not-html-error.svg
new file mode 100644
index 000000000..09fad21b7
--- /dev/null
+++ b/src/test/resources/epub3/files/content-document-svg/foreignObject-not-html-error.svg
@@ -0,0 +1,13 @@
+
+
diff --git a/src/test/resources/epub3/files/content-document-svg/foreignObject-requiredExtensions-ns-error.svg b/src/test/resources/epub3/files/content-document-svg/foreignObject-requiredExtensions-ns-error.svg
deleted file mode 100644
index bb773d3a5..000000000
--- a/src/test/resources/epub3/files/content-document-svg/foreignObject-requiredExtensions-ns-error.svg
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
diff --git a/src/test/resources/epub3/files/content-document-svg/foreignObject-requiredExtensions-valid.svg b/src/test/resources/epub3/files/content-document-svg/foreignObject-requiredExtensions-valid.svg
new file mode 100644
index 000000000..79bcc86b3
--- /dev/null
+++ b/src/test/resources/epub3/files/content-document-svg/foreignObject-requiredExtensions-valid.svg
@@ -0,0 +1,13 @@
+
+
diff --git a/src/test/resources/epub3/files/content-document-svg/foreignObject-valid.svg b/src/test/resources/epub3/files/content-document-svg/foreignObject-valid.svg
index 9ed4a23dd..272b8abdb 100644
--- a/src/test/resources/epub3/files/content-document-svg/foreignObject-valid.svg
+++ b/src/test/resources/epub3/files/content-document-svg/foreignObject-valid.svg
@@ -1,10 +1,13 @@
diff --git a/src/test/resources/epub3/files/content-document-svg/id-invalid-error.svg b/src/test/resources/epub3/files/content-document-svg/id-invalid-error.svg
new file mode 100644
index 000000000..023c2e5ce
--- /dev/null
+++ b/src/test/resources/epub3/files/content-document-svg/id-invalid-error.svg
@@ -0,0 +1,5 @@
+
+
diff --git a/src/test/resources/epub3/files/content-document-svg/title-html-invalid-error.svg b/src/test/resources/epub3/files/content-document-svg/title-html-invalid-error.svg
new file mode 100644
index 000000000..ff287bba0
--- /dev/null
+++ b/src/test/resources/epub3/files/content-document-svg/title-html-invalid-error.svg
@@ -0,0 +1,5 @@
+
+
diff --git a/src/test/resources/epub3/files/content-document-svg/title-not-phrasing-content-error.svg b/src/test/resources/epub3/files/content-document-svg/title-not-phrasing-content-error.svg
new file mode 100644
index 000000000..5e577203f
--- /dev/null
+++ b/src/test/resources/epub3/files/content-document-svg/title-not-phrasing-content-error.svg
@@ -0,0 +1,5 @@
+
+
diff --git a/src/test/resources/epub3/files/content-document-svg/title-phrasing-content-valid.svg b/src/test/resources/epub3/files/content-document-svg/title-phrasing-content-valid.svg
new file mode 100644
index 000000000..af7f1a5e5
--- /dev/null
+++ b/src/test/resources/epub3/files/content-document-svg/title-phrasing-content-valid.svg
@@ -0,0 +1,5 @@
+
+
diff --git a/src/test/resources/epub3/files/content-document-svg/title-text-valid.svg b/src/test/resources/epub3/files/content-document-svg/title-text-valid.svg
new file mode 100644
index 000000000..9e68f0f9c
--- /dev/null
+++ b/src/test/resources/epub3/files/content-document-svg/title-text-valid.svg
@@ -0,0 +1,5 @@
+
+
diff --git a/src/test/resources/epub3/files/content-document-xhtml/svg-foreignObject-html-invalid-error.xhtml b/src/test/resources/epub3/files/content-document-xhtml/svg-foreignObject-html-invalid-error.xhtml
new file mode 100644
index 000000000..778d8fc7c
--- /dev/null
+++ b/src/test/resources/epub3/files/content-document-xhtml/svg-foreignObject-html-invalid-error.xhtml
@@ -0,0 +1,19 @@
+
+
+
+
+ Test
+
+
+