chily 3 years ago
parent
commit
364c2a7a40
  1. 2
      pom.xml
  2. 14
      src/main/java/com/alibaba/excel/analysis/v07/XlsxSaxAnalyser.java

2
pom.xml

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>3.0.5</version>
<version>3.0.6</version>
<packaging>jar</packaging>
<name>easyexcel</name>

14
src/main/java/com/alibaba/excel/analysis/v07/XlsxSaxAnalyser.java

@ -41,10 +41,7 @@ import org.apache.poi.xssf.usermodel.XSSFRelation;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbookPr;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.WorkbookDocument;
import org.xml.sax.ContentHandler;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.*;
/**
* @author jipengfei
@ -188,7 +185,16 @@ public class XlsxSaxAnalyser implements ExcelReadExecutor {
} else {
saxFactory = SAXParserFactory.newInstance(xlsxSAXParserFactoryName, null);
}
try {
saxFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
} catch (SAXNotRecognizedException e) {
log.warn(
"SAXNotRecognizedException occur, not supported feature: " +
"http://apache.org/xml/features/disallow-doctype-decl, which will disable DOCTYPE declaration" +
" if set true.");
}
saxFactory.setFeature("http://xml.org/sax/features/external-general-entities", false);
saxFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
SAXParser saxParser = saxFactory.newSAXParser();

Loading…
Cancel
Save