当前位置:网站首页>Disable access to external entities in XML parsing
Disable access to external entities in XML parsing
2022-07-02 05:17:00 【◢◤】
- Use SAXReader Read XML data
SAXReader saxReader = new SAXReader();
Document userDocument = null;
try {
// Read xml The data is Document object
Document document = saxReader.read(new ByteArrayInputStream(xmlData.getBytes(StandardCharsets.UTF_8)));
String signatureContent = document.getRootElement().element("signatureContent").getData().toString();
// Base64 Parse and get data
byte[] byteData = Base64.decode(signatureContent);
String data = new String(byteData, StandardCharsets.UTF_8);
userDocument = saxReader.read(new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8)));
} catch (DocumentException e) {
}
- Use SonarLint Scan code prompt Disable access to external entities in XML parsing, Remind that risks are prohibited in XML Accessing external entities in parsing
// close DTD analysis
SAXReader saxReader = SAXReader.createDefault();
Document userDocument = null;
try {
// Read xml The data is Document object
Document document = saxReader.read(new ByteArrayInputStream(xmlData.getBytes(StandardCharsets.UTF_8)));
String signatureContent = document.getRootElement().element("signatureContent").getData().toString();
// Base64 Parse and get data
byte[] byteData = Base64.decode(signatureContent);
String data = new String(byteData, StandardCharsets.UTF_8);
userDocument = saxReader.read(new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8)));
} catch (DocumentException e) {
result.addElement("status").addText("1");
result.addElement("failReason").addText(e.getMessage());
log.error(" analysis xml The data of failure : " + e.getMessage(), e);
}

Use SAXReader.createDefault() To generate a parser , The settings inside are turned off DTO analysis .
边栏推荐
- 2022 Alibaba global mathematics competition, question 4, huhushengwei (blind box problem, truck problem) solution ideas
- Implementation of leetcode two number addition go
- How to make an RPM file
- Save the CDA from the disc to the computer
- Go GC garbage collection notes (three color mark)
- Gee series: Unit 3 raster remote sensing image band characteristics and rendering visualization
- Dark horse notes -- map set system
- Super detailed pycharm tutorial
- Cultivate primary and secondary school students' love for educational robots
- Go implements leetcode rotation array
猜你喜欢

Fabric.js IText设置指定文字的颜色和背景色

Collectors.groupingBy 排序

Save the CDA from the disc to the computer

Latest: the list of universities and disciplines for the second round of "double first-class" construction was announced

Nodejs (02) - built in module
![Gee: analyze the change of spatial centroid of remote sensing image [centroid acquisition analysis]](/img/25/a726643b96b6f7dbfee3782c4905d9.jpg)
Gee: analyze the change of spatial centroid of remote sensing image [centroid acquisition analysis]

Cubemx DMA notes

The underlying principle of go map (storage and capacity expansion)

2022 Alibaba global mathematics competition, question 4, huhushengwei (blind box problem, truck problem) solution ideas

Gee: create a new feature and set corresponding attributes
随机推荐
数据的储存
Ansible installation and use
Foreign trade marketing website system development function case making
Here comes the chicken soup! Keep this quick guide for data analysts
Gee series: Unit 2 explore datasets
Video multiple effects production, fade in effect and border background are added at the same time
Splice characters in {{}}
How matlab marks' a 'in the figure and how matlab marks points and solid points in the figure
Using QA band and bit mask in Google Earth engine
Basic differences between Oracle and MySQL (entry level)
paddle: ValueError:quality setting only supported for ‘jpeg‘ compression
MMAP zero copy knowledge point notes
Gee: use of common mask functions in remote sensing image processing [updatemask]
6.30 year end summary, end of student age
Fabric.js 圆形笔刷
7.1模擬賽總結
Global and Chinese market of hydrocyclone desander 2022-2028: Research Report on technology, participants, trends, market size and share
CubeMx DMA笔记
php/js cookie共享跨域的问题
Gee data set: export the distribution and installed capacity of hydropower stations in the country to CSV table