|
@@ -1096,22 +1096,53 @@ public class WebVOTransformService {
|
|
|
|
|
|
|
|
|
|
public String getClaimFromWeb(String cnFullXmlStr) throws Exception {
|
|
public String getClaimFromWeb(String cnFullXmlStr) throws Exception {
|
|
|
|
+ List<String> reClaims = new ArrayList<>();
|
|
SAXReader reader = new SAXReader();
|
|
SAXReader reader = new SAXReader();
|
|
reader.setEntityResolver(new IgnoreDTDEntityResolver());
|
|
reader.setEntityResolver(new IgnoreDTDEntityResolver());
|
|
Reader stringReader = new StringReader(cnFullXmlStr);
|
|
Reader stringReader = new StringReader(cnFullXmlStr);
|
|
Document document = reader.read(stringReader);
|
|
Document document = reader.read(stringReader);
|
|
- XPath xpath = document.createXPath("//claim-text");
|
|
|
|
- List<Element> element = (List<Element>) xpath.selectNodes(document);
|
|
|
|
- if (element.size() == 0) {
|
|
|
|
- xpath = document.createXPath("//business:ClaimText");
|
|
|
|
- element = (List<Element>) xpath.selectNodes(document);
|
|
|
|
|
|
+ XPath claimXpath = document.createXPath("//business:Claim");
|
|
|
|
+ List<Element> claimElements = new ArrayList<>();
|
|
|
|
+ try {
|
|
|
|
+ claimElements = (List<Element>) claimXpath.selectNodes(document);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+
|
|
}
|
|
}
|
|
- List<String> reClaims = new ArrayList<>();
|
|
|
|
- element.forEach(item -> {
|
|
|
|
- String claim = item.getText();
|
|
|
|
- claim = claim.replaceAll("\r\n|\r|\n|\t| ", "");
|
|
|
|
- reClaims.add(claim);
|
|
|
|
- });
|
|
|
|
|
|
+
|
|
|
|
+ if (claimElements.size() != 0) {
|
|
|
|
+ claimElements.forEach(item -> {
|
|
|
|
+ StringBuilder stringBuilder = new StringBuilder();
|
|
|
|
+ List<Element> claimTextElements = item.elements("ClaimText");
|
|
|
|
+ claimTextElements.forEach(tem -> {
|
|
|
|
+ String claim = tem.getText();
|
|
|
|
+ claim = claim.replaceAll("\r\n|\r|\n|\t| ", "");
|
|
|
|
+ stringBuilder.append(claim);
|
|
|
|
+ });
|
|
|
|
+ String claim = stringBuilder.toString();
|
|
|
|
+ if (claim != null && !claim.trim().equals("")) {
|
|
|
|
+ reClaims.add(claim);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ claimXpath = document.createXPath("//claim");
|
|
|
|
+ claimElements = (List<Element>) claimXpath.selectNodes(document);
|
|
|
|
+ claimElements.forEach(item -> {
|
|
|
|
+ StringBuilder stringBuilder = new StringBuilder();
|
|
|
|
+ List<Element> claimTextElements = item.elements("claim-text");
|
|
|
|
+ claimTextElements.forEach(tem -> {
|
|
|
|
+ String claim = tem.getText();
|
|
|
|
+ claim = claim.replaceAll("\r\n|\r|\n|\t| ", "");
|
|
|
|
+ stringBuilder.append(claim);
|
|
|
|
+ });
|
|
|
|
+ String claim = stringBuilder.toString();
|
|
|
|
+ if (claim != null && !claim.trim().equals("")) {
|
|
|
|
+ reClaims.add(claim);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
String reClaim = "";
|
|
String reClaim = "";
|
|
if (reClaims.size() != 0) {
|
|
if (reClaims.size() != 0) {
|