-
Notifications
You must be signed in to change notification settings - Fork 402
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: allow foreign namespaces in SVG content documents
Main changes: - switch to a master NVDL schema for SVG Content Document validation (in EPUB 3) - allow elements and attributes in foreign namespaces in SVG Content Documents, except where otherwise forbidden in the spec (i.e. in the `foreignObject` element, where only HTML is allowed) - allow `data-*` attributes in SVG (by removing them at parsing time) - add more tests Also: - slightly refactor the attribute pre-processing in XMLParser Fix #491
- Loading branch information
1 parent
cfca41b
commit ca29c89
Showing
15 changed files
with
201 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 51 additions & 12 deletions
63
src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-30.nvdl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,54 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<rules xmlns="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0" startMode="svg"> | ||
<mode name="svg"> | ||
<namespace ns="http://www.w3.org/2000/svg"> | ||
<validate schema="epub-svg-30.rnc" schemaType="application/relax-ng-compact-syntax" | ||
useMode="attach"/> | ||
<validate schema="epub-svg-30.sch" useMode="attach"/> | ||
</namespace> | ||
</mode> | ||
<mode name="attach"> | ||
<anyNamespace> | ||
<attach/> | ||
</anyNamespace> | ||
</mode> | ||
<mode name="svg"> | ||
<namespace ns="http://www.w3.org/2000/svg"> | ||
<validate schema="epub-svg-30.rnc" schemaType="application/relax-ng-compact-syntax" | ||
useMode="allowForeignNS"> | ||
<context path="foreignObject" useMode="allowHTMLOnly"/> | ||
</validate> | ||
<validate schema="epub-svg-30.sch" useMode="attachAnyNS"/> | ||
</namespace> | ||
</mode> | ||
<mode name="allowForeignNS"> | ||
<namespace ns="http://www.w3.org/1999/xhtml"> | ||
<attach/> | ||
</namespace> | ||
<namespace ns="http://www.idpf.org/2007/ops" match="attributes"> | ||
<attach/> | ||
</namespace> | ||
<namespace ns="http://www.w3.org/1999/xlink" match="attributes"> | ||
<attach/> | ||
</namespace> | ||
<namespace ns="http://www.w3.org/XML/1998/namespace" match="attributes"> | ||
<attach/> | ||
</namespace> | ||
<namespace ns="" match="attributes"> | ||
<attach/> | ||
</namespace> | ||
<anyNamespace match="elements attributes"> | ||
<allow/> | ||
</anyNamespace> | ||
</mode> | ||
<mode name="allowHTMLOnly"> | ||
<namespace ns="http://www.w3.org/1999/xhtml"> | ||
<attach/> | ||
</namespace> | ||
<namespace ns="http://www.idpf.org/2007/ops" match="attributes"> | ||
<attach/> | ||
</namespace> | ||
<namespace ns="http://www.w3.org/1999/xlink" match="attributes"> | ||
<attach/> | ||
</namespace> | ||
<namespace ns="http://www.w3.org/XML/1998/namespace" match="attributes"> | ||
<attach/> | ||
</namespace> | ||
<namespace ns="" match="attributes"> | ||
<attach/> | ||
</namespace> | ||
</mode> | ||
<mode name="attachAnyNS"> | ||
<anyNamespace> | ||
<attach/> | ||
</anyNamespace> | ||
</mode> | ||
</rules> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions
10
...st/resources/30/single/svg/invalid/foreignObject-invalid-requiredExtensions.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions
12
src/test/resources/30/single/svg/invalid/foreignObject-non-html-content.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions
11
src/test/resources/30/single/svg/invalid/foreignObject-two-body.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.