8130078: Document better processing

Reviewed-by: dfuchs, lancea, ahgross
This commit is contained in:
Joe Wang 2015-07-07 16:57:55 -07:00
parent 1e46af2eae
commit 7ed29c81ee
3 changed files with 37 additions and 5 deletions

View file

@ -379,6 +379,26 @@ implements XMLDTDScanner, XMLComponent, XMLEntityHandler {
} // scanDTDInternalSubset(boolean,boolean,boolean):boolean } // 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 // XMLComponent methods
// //

View file

@ -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 @@ public class XMLDocumentScannerImpl
again = false; again = false;
switch (fScannerState) { switch (fScannerState) {
case SCANNER_STATE_DTD_INTERNAL_DECLS: { case SCANNER_STATE_DTD_INTERNAL_DECLS: {
boolean moreToScan = false;
if (!fDTDScanner.skipDTD(fSupportDTD)) {
// REVISIT: Should there be a feature for // REVISIT: Should there be a feature for
// the "complete" parameter? // the "complete" parameter?
boolean completeDTD = true; boolean completeDTD = true;
boolean moreToScan = fDTDScanner.scanDTDInternalSubset(completeDTD, fStandalone, fHasExternalDTD && fLoadExternalDTD); moreToScan = fDTDScanner.scanDTDInternalSubset(completeDTD, fStandalone, fHasExternalDTD && fLoadExternalDTD);
}
Entity entity = fEntityScanner.getCurrentEntity(); Entity entity = fEntityScanner.getCurrentEntity();
if(entity instanceof Entity.ScannedEntity){ if(entity instanceof Entity.ScannedEntity){
fEndPos=((Entity.ScannedEntity)entity).position; fEndPos=((Entity.ScannedEntity)entity).position;

View file

@ -96,5 +96,14 @@ public interface XMLDTDScanner
public boolean scanDTDExternalSubset(boolean complete) public boolean scanDTDExternalSubset(boolean complete)
throws IOException, XNIException; 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); public void setLimitAnalyzer(XMLLimitAnalyzer limitAnalyzer);
} // interface XMLDTDScanner } // interface XMLDTDScanner