Skip to content

Commit f3e5f67

Browse files
committed
feat: allow NCX documents to declare a doctype
Fix #1329
1 parent e64c7c5 commit f3e5f67

File tree

5 files changed

+32
-3
lines changed

5 files changed

+32
-3
lines changed

src/main/java/com/adobe/epubcheck/xml/handlers/DeclarationHandler.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ else if (publicId != null || systemId != null)
134134
isAllowed = "-//W3C//DTD MathML 3.0//EN".equals(publicId)
135135
&& "http://www.w3.org/Math/DTD/mathml3/mathml3.dtd".equals(systemId);
136136
break;
137+
case "application/x-dtbncx+xml":
138+
isAllowed = "-//NISO//DTD ncx 2005-1//EN".equals(publicId)
139+
&& "http://www.daisy.org/z3986/2005/ncx-2005-1.dtd".equals(systemId);
140+
break;
137141
default:
138142
isAllowed = false;
139143
}

src/test/resources/epub3/B-external-identifiers/external-identifiers.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
Given EPUB test files located at '/epub3/B-external-identifiers/files/'
1111
And EPUBCheck with default settings
1212

13-
13+
@spec @xref:app-identifiers-allowed
1414
Scenario: Verify DOCTYPE declarations with allowed external identifiers
1515
When checking EPUB 'xml-external-identifier-allowed-valid'
1616
Then no errors or warnings are reported
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE math PUBLIC "-//NISO//DTD ncx 2005-1//EN" "http://www.daisy.org/z3986/2005/ncx-2005-1.dtd">
3+
<ncx xmlns:ncx="http://www.daisy.org/z3986/2005/ncx/"
4+
xmlns="http://www.daisy.org/z3986/2005/ncx/"
5+
version="2005-1"
6+
xml:lang="en">
7+
<head>
8+
<meta name="dtb:uid" content="NOID"/>
9+
<meta name="dtb:depth" content="1"/>
10+
<meta name="dtb:totalPageCount" content="0"/>
11+
<meta name="dtb:maxPageNumber" content="0"/>
12+
</head>
13+
<docTitle>
14+
<text>NCX</text>
15+
</docTitle>
16+
<navMap>
17+
<navPoint id="ch1" playOrder="1">
18+
<navLabel>
19+
<text>Chapter 1</text>
20+
</navLabel>
21+
<content src="content_001.xhtml"/>
22+
</navPoint>
23+
</navMap>
24+
</ncx>

src/test/resources/epub3/B-external-identifiers/files/xml-external-identifier-allowed-valid/EPUB/package.opf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
<item id="mathml-2" href="mathml-mediatype-2.xml" media-type="application/mathml-presentation+xml" fallback="content_001"/>
1414
<item id="mathml-3" href="mathml-mediatype-3.xml" media-type="application/mathml-content+xml" fallback="content_001"/>
1515
<item id="svg" href="svg.svg" media-type="image/svg+xml"/>
16+
<item id="ncx" href="nav.ncx" media-type="application/x-dtbncx+xml" />
1617
</manifest>
17-
<spine>
18+
<spine toc="ncx">
1819
<itemref idref="content_001" />
1920
<itemref idref="svg"/>
2021
<itemref idref="mathml-1"/>

src/test/resources/epub3/B-external-identifiers/files/xml-external-identifier-disallowed-error/EPUB/toc.ncx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<!DOCTYPE ncx PUBLIC "-//NISO//DTD ncx 2005-1//EN" "http://www.daisy.org/z3986/2005/ncx-2005-1.dtd">
2+
<!DOCTYPE ncx PUBLIC "-//NISO//DTD ncx 2005-1//EN" "http://example.org/dtd">
33
<ncx xmlns:ncx="http://www.daisy.org/z3986/2005/ncx/"
44
xmlns="http://www.daisy.org/z3986/2005/ncx/"
55
version="2005-1"

0 commit comments

Comments
 (0)