--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java Tue Jul 07 15:56:38 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java Tue Jul 07 16:57:55 2015 -0700
@@ -379,6 +379,26 @@
} // scanDTDInternalSubset(boolean,boolean,boolean):boolean
+ /**
+ * Skip the DTD if javax.xml.stream.supportDTD is false.
+ *
+ * @param supportDTD The value of the property javax.xml.stream.supportDTD.
+ * @return true if DTD is skipped, false otherwise.
+ * @throws java.io.IOException if i/o error occurs
+ */
+ @Override
+ public boolean skipDTD(boolean supportDTD) throws IOException {
+ if (!supportDTD) {
+ fStringBuffer.clear();
+ if (!fEntityScanner.scanData("]", fStringBuffer)) {
+ fEntityScanner.fCurrentEntity.position--;
+ }
+
+ return true;
+ }
+ return false;
+ }
+
//
// XMLComponent methods
//
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java Tue Jul 07 15:56:38 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java Tue Jul 07 16:57:55 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
*/
/*
@@ -1095,11 +1095,14 @@
again = false;
switch (fScannerState) {
case SCANNER_STATE_DTD_INTERNAL_DECLS: {
- // REVISIT: Should there be a feature for
- // the "complete" parameter?
- boolean completeDTD = true;
+ boolean moreToScan = false;
+ if (!fDTDScanner.skipDTD(fSupportDTD)) {
+ // REVISIT: Should there be a feature for
+ // the "complete" parameter?
+ boolean completeDTD = true;
- boolean moreToScan = fDTDScanner.scanDTDInternalSubset(completeDTD, fStandalone, fHasExternalDTD && fLoadExternalDTD);
+ moreToScan = fDTDScanner.scanDTDInternalSubset(completeDTD, fStandalone, fHasExternalDTD && fLoadExternalDTD);
+ }
Entity entity = fEntityScanner.getCurrentEntity();
if(entity instanceof Entity.ScannedEntity){
fEndPos=((Entity.ScannedEntity)entity).position;
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xni/parser/XMLDTDScanner.java Tue Jul 07 15:56:38 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xni/parser/XMLDTDScanner.java Tue Jul 07 16:57:55 2015 -0700
@@ -96,5 +96,14 @@
public boolean scanDTDExternalSubset(boolean complete)
throws IOException, XNIException;
+ /**
+ * Skip the DTD if javax.xml.stream.supportDTD is false.
+ * @param supportDTD The value of the property javax.xml.stream.supportDTD.
+ * @return true if DTD is skipped, false otherwise.
+ * @throws java.io.IOException if i/o error occurs
+ */
+ public boolean skipDTD(boolean supportDTD)
+ throws IOException;
+
public void setLimitAnalyzer(XMLLimitAnalyzer limitAnalyzer);
} // interface XMLDTDScanner