List of usage examples for org.apache.commons.lang3 StringEscapeUtils unescapeXml
public static final String unescapeXml(final String input)
Unescapes a string containing XML entity escapes to a string containing the actual Unicode characters corresponding to the escapes.
Supports only the five basic XML entities (gt, lt, quot, amp, apos).
From source file:fr.mcc.ginco.data.ReducedThesaurusTerm.java
public void setLexicalValue(String lexicalValue) { this.lexicalValue = StringEscapeUtils.unescapeXml(lexicalValue); }
From source file:ac.ucy.cs.spdx.service.SpdxViolationAnalysis.java
@POST @Path("/analyze/") @Consumes(MediaType.TEXT_PLAIN)/*from w ww .j a va2s. c o m*/ @Produces(MediaType.APPLICATION_JSON) public String analyzeSpdx(String jsonString) { ObjectMapper mapper = new ObjectMapper(); JsonNode spdxFilesContent = null; try { spdxFilesContent = mapper.readTree(jsonString); } catch (JsonProcessingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } ArrayList<SpdxLicensePairConflictError> fileNames = new ArrayList<SpdxLicensePairConflictError>(); for (JsonNode fileNode : spdxFilesContent.get("files")) { String fileName = fileNode.get("filename").toString(); fileName = fileName.substring(1, fileName.length() - 1); String content = fileNode.get("content").toString(); content = StringEscapeUtils.unescapeXml(content); content = content.substring(1, content.length() - 1); try { fileNames.add(new SpdxLicensePairConflictError( new CaptureLicense(ParseRdf.parseToRdf(fileName, content)))); } catch (InvalidLicenseStringException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (InvalidSPDXAnalysisException e) { e.printStackTrace(); } catch (UnsupportedSpdxVersionException e) { e.printStackTrace(); } } ViolationAnalysisInfo analysis = null; try { analysis = new ViolationAnalysisInfo( fileNames.toArray(new SpdxLicensePairConflictError[fileNames.size()])); } catch (LicenseNodeNotFoundException e) { e.printStackTrace(); } return analysis.toJson();// {"count":"","files":[{"filename":"","content":""}]} }
From source file:com.entertailion.android.overlaynews.rss.RssHandler.java
@Override public void endElement(String uri, String localName, String qName) { if (localName.equalsIgnoreCase("image")) { if (!isItem) { isImage = false;/*from www . j ava2s. c o m*/ } } else if (localName.equalsIgnoreCase("url")) { if (isImage) { feed.setLogo(StringEscapeUtils.unescapeXml(chars.toString())); } } else if (localName.equalsIgnoreCase("ttl")) { if (!isItem) { feed.setTtl(Integer.parseInt(StringEscapeUtils.unescapeXml(chars.toString()))); } } else if (localName.equalsIgnoreCase("title")) { if (!isImage) { if (isItem) { item.setTitle(StringEscapeUtils.unescapeXml(chars.toString())); } else { feed.setTitle(StringEscapeUtils.unescapeXml(chars.toString())); } } } else if (localName.equalsIgnoreCase("description")) { if (isItem) { item.setDescription(StringEscapeUtils.unescapeXml(chars.toString())); } else { feed.setDescription(StringEscapeUtils.unescapeXml(chars.toString())); } } else if (localName.equalsIgnoreCase("pubDate")) { if (isItem) { try { item.setDate(dateFormat.parse(StringEscapeUtils.unescapeXml(chars.toString()))); } catch (Exception e) { Log.e(LOG_CAT, "pubDate", e); } } else { try { feed.setDate(dateFormat.parse(StringEscapeUtils.unescapeXml(chars.toString()))); } catch (Exception e) { Log.e(LOG_CAT, "pubDate", e); } } } else if (localName.equalsIgnoreCase("item")) { isItem = false; } else if (localName.equalsIgnoreCase("link")) { if (isItem) { item.setLink(StringEscapeUtils.unescapeXml(chars.toString())); } else { feed.setLink(StringEscapeUtils.unescapeXml(chars.toString())); } } if (localName.equalsIgnoreCase("item")) { } }
From source file:fr.mcc.ginco.data.FullThesaurus.java
public void setContributor(String contributor) { this.contributor = StringEscapeUtils.unescapeXml(contributor); }
From source file:fr.mcc.ginco.data.FullThesaurus.java
public void setCoverage(String coverage) { this.coverage = StringEscapeUtils.unescapeXml(coverage); }
From source file:net.jeremybrooks.readsy.bo.ReadsyEntryElement.java
/** * Set heading./*from ww w .j av a 2s . c o m*/ * * @param heading the value of the heading element. */ public void setHeading(String heading) { this.heading = StringEscapeUtils.unescapeXml(heading); }
From source file:fr.mcc.ginco.exports.skos.SKOSTermsExporter.java
/** * Export concept preferred terms to SKOS using the skos API. * * @param prefTerms//ww w . ja v a 2s . c o m * @param model * @param conceptResource * @return list of concept preferred terms for skos */ public Model exportConceptPreferredTerms(List<ThesaurusTerm> prefTerms, Model model, Resource conceptResource) { for (ThesaurusTerm prefTerm : prefTerms) { model.add(conceptResource, SKOS.PREF_LABEL, StringEscapeUtils.unescapeXml(prefTerm.getLexicalValue()), prefTerm.getLanguage().getId()); model.add(conceptResource, SKOSXL.PREF_LABEL, model.createResource(prefTerm.getIdentifier())); skosModelTermsExporter.exportConceptPreferredTerm(prefTerm, model); } return model; }
From source file:fr.mcc.ginco.exports.skos.SKOSModelTermsExporter.java
public Model exportConceptPreferredTerm(ThesaurusTerm term, Model model) { logger.debug("Start generating model for preferred term " + term.getLexicalValue()); Resource prefTermRes = model.createResource(term.getIdentifier(), ISOTHES.PREFERRED_TERM); model.add(prefTermRes, DCTerms.created, DateUtil.toISO8601String(term.getCreated())); model.add(prefTermRes, DCTerms.modified, DateUtil.toISO8601String(term.getModified())); model.add(prefTermRes, SKOSXL.LITERAL_FORM, StringEscapeUtils.unescapeXml(term.getLexicalValue()), term.getLanguage().getId()); model.add(prefTermRes, ISOTHES.STATUS, term.getStatus().toString()); if (StringUtils.isNotEmpty(term.getSource())) { model.add(prefTermRes, DC.source, StringEscapeUtils.unescapeXml(term.getSource())); }//from w ww. j a v a 2s . c o m return model; }
From source file:fr.mcc.ginco.rest.services.SearcherRestService.java
@POST @Path("/search") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) public ExtJsonFormLoadData<List<SearchResult>> search(FilterCriteria filter) { try {// w w w . j a v a 2 s . c o m SortCriteria sort = new SortCriteria(filter.getSortfield(), filter.getSortdir()); SearchResultList searchResults = searcherService.search( StringEscapeUtils.unescapeXml(filter.getQuery()), filter.getType(), filter.getThesaurus(), filter.getStatus(), filter.getCreationdate(), filter.getModificationdate(), filter.getLanguage(), sort, filter.getStart(), filter.getLimit()); ExtJsonFormLoadData<List<SearchResult>> extSearchResults = new ExtJsonFormLoadData<List<SearchResult>>( searchResults); extSearchResults.setTotal(searchResults.getNumFound()); return extSearchResults; } catch (SolrServerException e) { throw new TechnicalException("Search exception", e); } }
From source file:fr.mcc.ginco.exports.skos.SKOSNotesExporter.java
/** * Export concept notes to SKOS using the skos API * * @return//from w ww . j av a2 s . co m */ public Model exportNotes(Model model, List<ThesaurusTerm> prefTerms, ThesaurusConcept concept) { Resource conceptRes = model.createResource(concept.getIdentifier()); List<Note> notes = noteService.getConceptNotePaginatedList(concept.getIdentifier(), 0, 0); for (ThesaurusTerm prefTerm : prefTerms) { List<Note> termNotes = noteService.getTermNotePaginatedList(prefTerm.getIdentifier(), 0, 0); notes.addAll(termNotes); } for (Note note : notes) { String lexicalValue = StringEscapeUtils.unescapeXml(note.getLexicalValue()); String lang = note.getLanguage().getId(); if ("historyNote".equals(note.getNoteType().getCode())) { model.add(conceptRes, SKOS.HISTORY_NOTE, lexicalValue, lang); } else if ("scopeNote".equals(note.getNoteType().getCode())) { model.add(conceptRes, SKOS.SCOPE_NOTE, lexicalValue, lang); } else if ("example".equals(note.getNoteType().getCode())) { model.add(conceptRes, SKOS.EXAMPLE, lexicalValue, lang); } else if ("definition".equals(note.getNoteType().getCode())) { model.add(conceptRes, SKOS.DEFINITION, lexicalValue, lang); } } return model; }