100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > java 去除html标签属性_[Java]去除html中的标签或者元素属性(正则表达式)

java 去除html标签属性_[Java]去除html中的标签或者元素属性(正则表达式)

时间:2022-03-20 14:33:48

相关推荐

java 去除html标签属性_[Java]去除html中的标签或者元素属性(正则表达式)

@RequestMapping(value = "/details", method =RequestMethod.GET)

@ResponseBody

@ApiOperation(value= "详情页面", httpMethod = "GET", produces = "application/json")public AjaxResult details(@ApiParam(required = true, name="id", value="id") @RequestParam(required = true,value = "id")String id) {//定义HTML标签的正则表达式

String regEx_html = "]+>";

Pattern p_html=pile(regEx_html, Pattern.CASE_INSENSITIVE);if(mon.utils.StringUtils.isBlank(id)) {

AjaxResult.error("id不能为空!");

}

Articleinformation articleinformation=articleinformationService.selectArticleinformationById(id);if (articleinformation == null) {

Bookinformation bookinformation=bookinformationService.selectBookinformationById(id);if (bookinformation == null) {

Mediaphoto mediaphoto=mediaphotoService.selectMediaphotoById(id);if (mediaphoto == null) {

Archaeological archaeological=archaeologicalService.selectArchaeologicalById(id);if (archaeological == null) {

Scholar scholar=scholarService.selectScholarById(id);if (scholar == null) {

Institution institution=institutionService.selectInstitutionById(id);if (institution != null) {return AjaxResult.success().put("result",institution);

}else{returnAjaxResult.error();

}

}else{return AjaxResult.success().put("result",scholar);

}

}else{//archaeological.setContents(HtmlUtils.htmlUnescape(archaeological.getContents()));

Matcher m_html=p_html.matcher(archaeological.getContents());

archaeological.setContents(m_html.replaceAll(""));return AjaxResult.success().put("result",archaeological);

}

}else{//mediaphoto.setSunmmaryContents(HtmlUtils.htmlUnescape(mediaphoto.getSunmmaryContents()));

Matcher m_html =p_html.matcher(mediaphoto.getSunmmaryContents());

mediaphoto.setSunmmaryContents(m_html.replaceAll(""));return AjaxResult.success().put("result",mediaphoto);

}

}else{//bookinformation.setContent(HtmlUtils.htmlUnescape(bookinformation.getContent()));

Matcher m_html =p_html.matcher(bookinformation.getContent());

bookinformation.setContent(m_html.replaceAll(""));return AjaxResult.success().put("result",bookinformation);

}

}else{//articleinformation.setSummaryContents(HtmlUtils.htmlUnescape(articleinformation.getSummaryContents()));

Matcher m_html =p_html.matcher(articleinformation.getSummaryContents());

articleinformation.setSummaryContents(m_html.replaceAll(""));return AjaxResult.success().put("result",articleinformation);

}

}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。