Skip to content

Commit 3a3bcd5

Browse files
committed
8344800: Add W3C DTDs and XSDs to the JDK built-in Catalog
Reviewed-by: lancea, rriggs
1 parent 940aa7c commit 3a3bcd5

File tree

106 files changed

+27706
-17
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+27706
-17
lines changed

make/modules/java.xml/Java.gmk

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ DISABLED_WARNINGS_java += dangling-doc-comments lossy-conversions this-escape
2727
DOCLINT += -Xdoclint:all/protected \
2828
'-Xdoclint/package:$(call CommaList, javax.xml.catalog javax.xml.datatype \
2929
javax.xml.transform javax.xml.validation javax.xml.xpath)'
30-
COPY += .dtd .xsd .xml
30+
COPY += .dtd .xsd .xml .ent .mod
3131
CLEAN += .properties

src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -1209,11 +1209,12 @@ public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) th
12091209

12101210
// Step 1: custom Entity resolver
12111211
XMLInputSource xmlInputSource = null;
1212-
1212+
boolean resolveByResolver = false;
12131213
if (fEntityResolver != null) {
12141214
resourceIdentifier.setBaseSystemId(baseSystemId);
12151215
resourceIdentifier.setExpandedSystemId(expandedSystemId);
12161216
xmlInputSource = fEntityResolver.resolveEntity(resourceIdentifier);
1217+
resolveByResolver = xmlInputSource != null;
12171218
}
12181219

12191220
// Step 2: custom catalog if specified
@@ -1229,7 +1230,8 @@ public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) th
12291230
}
12301231

12311232
// Step 3: use the default JDK Catalog Resolver if Step 2's resolve is continue
1232-
if (xmlInputSource == null
1233+
if ((xmlInputSource == null || (!resolveByResolver && xmlInputSource.getSystemId() != null
1234+
&& xmlInputSource.getSystemId().equals(literalSystemId)))
12331235
&& (publicId != null || literalSystemId != null)
12341236
&& JdkXmlUtils.isResolveContinue(fCatalogFeatures)) {
12351237
initJdkCatalogResolver();

src/java.xml/share/classes/jdk/xml/internal/jdkcatalog/JDKCatalog.xml

+117-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/*
4-
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
4+
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
55
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
66
*
77
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
2626
*/
2727
-->
2828
<!--
29-
Catalog of DTDs for the Java platform
29+
Catalog of DTDs and XSDs for the Java platform and W3C specifications
3030
3131
@implNote: DTDs in the built-in catalog are resolved against its URI and the
3232
xml:base attribute. The preferences.dtd for example is resolved as:
@@ -38,4 +38,119 @@
3838
<system systemId="http://java.sun.com/dtd/preferences.dtd" uri="preferences.dtd"/>
3939
<system systemId="http://java.sun.com/dtd/properties.dtd" uri="properties.dtd"/>
4040
</group>
41+
42+
<!-- W3C DTDs -->
43+
<group id="xhtml11" prefer = "system" xml:base = "w3c/dtd/xhtml11/">
44+
<system systemId="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" uri="xhtml11.dtd"/>
45+
<systemSuffix systemIdSuffix="xhtml-attribs-1.mod" uri="xhtml-attribs-1.mod"/>
46+
<systemSuffix systemIdSuffix="xhtml-base-1.mod" uri="xhtml-base-1.mod"/>
47+
<systemSuffix systemIdSuffix="xhtml-bdo-1.mod" uri="xhtml-bdo-1.mod"/>
48+
<systemSuffix systemIdSuffix="xhtml-blkphras-1.mod" uri="xhtml-blkphras-1.mod"/>
49+
<systemSuffix systemIdSuffix="xhtml-blkpres-1.mod" uri="xhtml-blkpres-1.mod"/>
50+
<systemSuffix systemIdSuffix="xhtml-blkstruct-1.mod" uri="xhtml-blkstruct-1.mod"/>
51+
<systemSuffix systemIdSuffix="xhtml-charent-1.mod" uri="xhtml-charent-1.mod"/>
52+
<systemSuffix systemIdSuffix="xhtml-cicmap-1.mod" uri="xhtml-cicmap-1.mod"/>
53+
<systemSuffix systemIdSuffix="xhtml-csismap-1.mod" uri="xhtml-csismap-1.mod"/>
54+
<systemSuffix systemIdSuffix="xhtml-datatypes-1.mod" uri="xhtml-datatypes-1.mod"/>
55+
<systemSuffix systemIdSuffix="xhtml-edit-1.mod" uri="xhtml-edit-1.mod"/>
56+
<systemSuffix systemIdSuffix="xhtml-events-1.mod" uri="xhtml-events-1.mod"/>
57+
<systemSuffix systemIdSuffix="xhtml-form-1.mod" uri="xhtml-form-1.mod"/>
58+
<systemSuffix systemIdSuffix="xhtml-framework-1.mod" uri="xhtml-framework-1.mod"/>
59+
<systemSuffix systemIdSuffix="xhtml-hypertext-1.mod" uri="xhtml-hypertext-1.mod"/>
60+
<systemSuffix systemIdSuffix="xhtml-image-1.mod" uri="xhtml-image-1.mod"/>
61+
<systemSuffix systemIdSuffix="xhtml-inlphras-1.mod" uri="xhtml-inlphras-1.mod"/>
62+
<systemSuffix systemIdSuffix="xhtml-inlpres-1.mod" uri="xhtml-inlpres-1.mod"/>
63+
<systemSuffix systemIdSuffix="xhtml-inlstruct-1.mod" uri="xhtml-inlstruct-1.mod"/>
64+
<systemSuffix systemIdSuffix="xhtml-inlstyle-1.mod" uri="xhtml-inlstyle-1.mod"/>
65+
<systemSuffix systemIdSuffix="xhtml-lat1-1.mod" uri="xhtml-lat1-1.mod"/>
66+
<systemSuffix systemIdSuffix="xhtml-link-1.mod" uri="xhtml-link-1.mod"/>
67+
<systemSuffix systemIdSuffix="xhtml-list-1.mod" uri="xhtml-list-1.mod"/>
68+
<systemSuffix systemIdSuffix="xhtml-meta-1.mod" uri="xhtml-meta-1.mod"/>
69+
<systemSuffix systemIdSuffix="xhtml-object-1.mod" uri="xhtml-object-1.mod"/>
70+
<systemSuffix systemIdSuffix="xhtml-param-1.mod" uri="xhtml-param-1.mod"/>
71+
<systemSuffix systemIdSuffix="xhtml-pres-1.mod" uri="xhtml-pres-1.mod"/>
72+
<systemSuffix systemIdSuffix="xhtml-qname-1.mod" uri="xhtml-qname-1.mod"/>
73+
<systemSuffix systemIdSuffix="xhtml-ruby-1.mod" uri="xhtml-ruby-1.mod"/>
74+
<systemSuffix systemIdSuffix="xhtml-script-1.mod" uri="xhtml-script-1.mod"/>
75+
<systemSuffix systemIdSuffix="xhtml-special-1.mod" uri="xhtml-special-1.mod"/>
76+
<systemSuffix systemIdSuffix="xhtml-ssismap-1.mod" uri="xhtml-ssismap-1.mod"/>
77+
<systemSuffix systemIdSuffix="xhtml-struct-1.mod" uri="xhtml-struct-1.mod"/>
78+
<systemSuffix systemIdSuffix="xhtml-style-1.mod" uri="xhtml-style-1.mod"/>
79+
<systemSuffix systemIdSuffix="xhtml-symbol-1.mod" uri="xhtml-symbol-1.mod"/>
80+
<systemSuffix systemIdSuffix="xhtml-table-1.mod" uri="xhtml-table-1.mod"/>
81+
<systemSuffix systemIdSuffix="xhtml-text-1.mod" uri="xhtml-text-1.mod"/>
82+
<systemSuffix systemIdSuffix="xhtml11-model-1.mod" uri="xhtml11-model-1.mod"/>
83+
</group>
84+
85+
<group id="xhtml1" prefer = "system" xml:base = "w3c/dtd/xhtml10/">
86+
<systemSuffix systemIdSuffix="xhtml1-strict.dtd" uri="xhtml1-strict.dtd"/>
87+
<systemSuffix systemIdSuffix="xhtml1-transitional.dtd" uri="xhtml1-transitional.dtd"/>
88+
<systemSuffix systemIdSuffix="xhtml1-frameset.dtd" uri="xhtml1-frameset.dtd"/>
89+
<systemSuffix systemIdSuffix="xhtml-lat1.ent" uri="xhtml-lat1.ent"/>
90+
<systemSuffix systemIdSuffix="xhtml-special.ent" uri="xhtml-special.ent"/>
91+
<systemSuffix systemIdSuffix="xhtml-symbol.ent" uri="xhtml-symbol.ent"/>
92+
</group>
93+
94+
<group id="XMLSchema10" prefer = "system" xml:base = "w3c/dtd/schema10/">
95+
<systemSuffix systemIdSuffix="XMLSchema.dtd" uri="XMLSchema.dtd"/>
96+
<systemSuffix systemIdSuffix="datatypes.dtd" uri="datatypes.dtd"/>
97+
<public publicId="datatypes" uri="datatypes.dtd"/>
98+
<public publicId="-//W3C//DTD XMLSCHEMA 200102//EN" uri="XMLSchema.dtd"/>
99+
</group>
100+
101+
<group id="xmlspec" prefer = "system" xml:base = "w3c/dtd/">
102+
<system systemId="http://www.w3.org/2002/xmlspec/dtd/2.10/xmlspec.dtd" uri="xmlspec2_10/xmlspec.dtd"/>
103+
</group>
104+
105+
<!-- W3C XSDs -->
106+
<group id="w3cxsd" prefer = "system" xml:base = "w3c/xsd/">
107+
<systemSuffix systemIdSuffix="XMLSchema.xsd" uri="schema10/XMLSchema.xsd"/>
108+
<systemSuffix systemIdSuffix="XMLSchema-datatypes.xsd" uri="schema10/XMLSchema-datatypes.xsd"/>
109+
<system systemId="http://www.w3.org/2001/xml.xsd" uri="xmlNS2001/xml.xsd"/>
110+
<systemSuffix systemIdSuffix="2001/xml.xsd" uri="xmlNS2001/xml.xsd"/>
111+
<systemSuffix systemIdSuffix="xhtml1-frameset.xsd" uri="xhtml10/xhtml1-frameset.xsd"/>
112+
<systemSuffix systemIdSuffix="xhtml1-strict.xsd" uri="xhtml10/xhtml1-strict.xsd"/>
113+
<systemSuffix systemIdSuffix="xhtml1-transitional.xsd" uri="xhtml10/xhtml1-transitional.xsd"/>
114+
</group>
115+
<group id="xhtml11xsd" prefer = "system" xml:base = "w3c/xsd/xhtml11/">
116+
<systemSuffix systemIdSuffix="xhtml11.xsd" uri="xhtml11.xsd"/>
117+
<systemSuffix systemIdSuffix="xhtml-attribs-1.xsd" uri="xhtml-attribs-1.xsd"/>
118+
<systemSuffix systemIdSuffix="xhtml-base-1.xsd" uri="xhtml-base-1.xsd"/>
119+
<systemSuffix systemIdSuffix="xhtml-bdo-1.xsd" uri="xhtml-bdo-1.xsd"/>
120+
<systemSuffix systemIdSuffix="xhtml-blkphras-1.xsd" uri="xhtml-blkphras-1.xsd"/>
121+
<systemSuffix systemIdSuffix="xhtml-blkpres-1.xsd" uri="xhtml-blkpres-1.xsd"/>
122+
<systemSuffix systemIdSuffix="xhtml-blkstruct-1.xsd" uri="xhtml-blkstruct-1.xsd"/>
123+
<systemSuffix systemIdSuffix="xhtml-copyright-1.xsd" uri="xhtml-copyright-1.xsd"/>
124+
<systemSuffix systemIdSuffix="xhtml-csismap-1.xsd" uri="xhtml-csismap-1.xsd"/>
125+
<systemSuffix systemIdSuffix="xhtml-datatypes-1.xsd" uri="xhtml-datatypes-1.xsd"/>
126+
<systemSuffix systemIdSuffix="xhtml-edit-1.xsd" uri="xhtml-edit-1.xsd"/>
127+
<systemSuffix systemIdSuffix="xhtml-events-1.xsd" uri="xhtml-events-1.xsd"/>
128+
<systemSuffix systemIdSuffix="xhtml-form-1.xsd" uri="xhtml-form-1.xsd"/>
129+
<systemSuffix systemIdSuffix="xhtml-framework-1.xsd" uri="xhtml-framework-1.xsd"/>
130+
<systemSuffix systemIdSuffix="xhtml-hypertext-1.xsd" uri="xhtml-hypertext-1.xsd"/>
131+
<systemSuffix systemIdSuffix="xhtml-image-1.xsd" uri="xhtml-image-1.xsd"/>
132+
<systemSuffix systemIdSuffix="xhtml-inlphras-1.xsd" uri="xhtml-inlphras-1.xsd"/>
133+
<systemSuffix systemIdSuffix="xhtml-inlpres-1.xsd" uri="xhtml-inlpres-1.xsd"/>
134+
<systemSuffix systemIdSuffix="xhtml-inlstruct-1.xsd" uri="xhtml-inlstruct-1.xsd"/>
135+
<systemSuffix systemIdSuffix="xhtml-inlstyle-1.xsd" uri="xhtml-inlstyle-1.xsd"/>
136+
<systemSuffix systemIdSuffix="xhtml-link-1.xsd" uri="xhtml-link-1.xsd"/>
137+
<systemSuffix systemIdSuffix="xhtml-list-1.xsd" uri="xhtml-list-1.xsd"/>
138+
<systemSuffix systemIdSuffix="xhtml-meta-1.xsd" uri="xhtml-meta-1.xsd"/>
139+
<systemSuffix systemIdSuffix="xhtml-notations-1.xsd" uri="xhtml-notations-1.xsd"/>
140+
<systemSuffix systemIdSuffix="xhtml-object-1.xsd" uri="xhtml-object-1.xsd"/>
141+
<systemSuffix systemIdSuffix="xhtml-param-1.xsd" uri="xhtml-param-1.xsd"/>
142+
<systemSuffix systemIdSuffix="xhtml-pres-1.xsd" uri="xhtml-pres-1.xsd"/>
143+
<systemSuffix systemIdSuffix="xhtml-ruby-1.xsd" uri="xhtml-ruby-1.xsd"/>
144+
<systemSuffix systemIdSuffix="xhtml-script-1.xsd" uri="xhtml-script-1.xsd"/>
145+
<systemSuffix systemIdSuffix="xhtml-ssismap-1.xsd" uri="xhtml-ssismap-1.xsd"/>
146+
<systemSuffix systemIdSuffix="xhtml-struct-1.xsd" uri="xhtml-struct-1.xsd"/>
147+
<systemSuffix systemIdSuffix="xhtml-style-1.xsd" uri="xhtml-style-1.xsd"/>
148+
<systemSuffix systemIdSuffix="xhtml-table-1.xsd" uri="xhtml-table-1.xsd"/>
149+
<systemSuffix systemIdSuffix="xhtml-target-1.xsd" uri="xhtml-target-1.xsd"/>
150+
<systemSuffix systemIdSuffix="xhtml-text-1.xsd" uri="xhtml-text-1.xsd"/>
151+
<systemSuffix systemIdSuffix="xhtml11-model-1.xsd" uri="xhtml11-model-1.xsd"/>
152+
<systemSuffix systemIdSuffix="xhtml11-modules-1.xsd" uri="xhtml11-modules-1.xsd"/>
153+
<systemSuffix systemIdSuffix="xml-events-1.xsd" uri="xml-events-1.xsd"/>
154+
<systemSuffix systemIdSuffix="xml-events-copyright-1.xsd" uri="xml-events-copyright-1.xsd"/>
155+
</group>
41156
</catalog>

0 commit comments

Comments
 (0)