Example usage for org.apache.commons.lang3 StringEscapeUtils unescapeXml

List of usage examples for org.apache.commons.lang3 StringEscapeUtils unescapeXml

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringEscapeUtils unescapeXml.

Prototype

public static final String unescapeXml(final String input) 

Source Link

Document

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).

Usage

From source file:de.wbuecke.codec.XmlInput.java

@Override
public String decode(String input) {
    return StringEscapeUtils.unescapeXml(input);
}

From source file:com.yilang.commons.utils.util.Encodes.java

public static String unescapeXml(String xmlEscaped) {
    return StringEscapeUtils.unescapeXml(xmlEscaped);
}

From source file:hr.fer.tel.rovkp.homework03.task01.JokesCollection.java

public static Map<Integer, String> parseInputFile(String file) throws IOException {
    Path filePath = Paths.get(file);
    Map<Integer, String> results = new HashMap<>();

    List<String> currentJoke = new LinkedList<>();
    LinkedList<Integer> ids = new LinkedList<>();

    try (Stream<String> stream = Files.lines(filePath)) {
        stream.forEach(line -> {//from   w  ww  .  j a va2s.  c  o  m
            if (line == null)
                return;
            line = line.trim();

            if (line.isEmpty() && !currentJoke.isEmpty()) {
                int currentId = ids.getLast();
                String jokeText = StringUtils.join(currentJoke, "\n");
                jokeText = StringEscapeUtils.unescapeXml(jokeText.toLowerCase().replaceAll("\\<.*?\\>", ""));
                if (results.putIfAbsent(currentId, jokeText) != null)
                    System.err.println("Joke with id " + currentId + "already exists. Not overwriting.");
            } else if (line.matches("^[0-9]+:$")) {
                ids.addLast(Integer.parseInt(line.substring(0, line.length() - 1)));
                currentJoke.clear();
            } else {
                currentJoke.add(line);
            }
        });
    }

    return results;
}

From source file:de.shadowhunt.subversion.internal.BasicHandler.java

protected String getText() {
    return StringEscapeUtils.unescapeXml(buffer.toString());
}

From source file:com.oakhole.utils.StringUtils.java

public static String unescapeXml(String text) {
    return StringEscapeUtils.unescapeXml(text);
}

From source file:apm.common.utils.Encodes.java

/**
 * Xml ?.
 */
public static String unescapeXml(String xmlEscaped) {
    return StringEscapeUtils.unescapeXml(xmlEscaped);
}

From source file:com.tdclighthouse.prototype.servlets.JLatexServlet.java

@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    String latexExpression = req.getParameter(LATEX_PARAM);
    latexExpression = StringEscapeUtils.unescapeXml(latexExpression);

    if (latexExpression != null && !"".equals(latexExpression)) {
        BufferedImage image = generateImage(latexExpression);
        resp.setContentType(MIME_TYPE);//from ww w.ja  va 2s  .  com
        ImageIO.write(image, IMAGE_TYPE, resp.getOutputStream());
    } else {
        resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
    }
}

From source file:com.eryansky.common.utils.encode.EncodeUtils.java

/**
 * Xml ?.
 */
public static String xmlUnescape(String xmlEscaped) {
    return StringEscapeUtils.unescapeXml(xmlEscaped);
}

From source file:$.Encodes.java

/**
     * Xml ?.
     */
    public static String unescapeXml(String xmlEscaped) {
        return StringEscapeUtils.unescapeXml(xmlEscaped);
    }

From source file:fr.mcc.ginco.data.ReducedThesaurus.java

public void setTitle(String title) {
    this.title = StringEscapeUtils.unescapeXml(title);
}