Java XML Unescape unescapeXml(String input)

Here you can find the source of unescapeXml(String input)

Description

unescape Xml

License

Open Source License

Declaration

public static String unescapeXml(String input) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    private static final String[] encoded = { "&", "<", ">",
            """, "'" };
    private static final String[] decoded_origin = { "&", "<", ">", "\"",
            "\'" };

    public static String unescapeXml(String input) {
        if (input == null) {
            return null;
        }/*from   w w w .ja  v  a 2s  .  c  o  m*/
        return translateAll(input, encoded, decoded_origin);
    }

    public static String translateAll(String input, String[] patterns,
            String[] replacements) {
        String result = input;

        for (int i = 0; i < patterns.length; i++) {
            result = result.replaceAll(patterns[i], replacements[i]);
        }

        return result;
    }
}

Related

  1. unescapeFromXML(String string)
  2. unescapeFromXML(String string)
  3. unescapeFromXML(String string)
  4. unescapeFromXML(String string)
  5. unescapeXML(final String s)
  6. unescapeXml(String input)
  7. unescapeXML(String s)
  8. unescapeXml(String src)
  9. unescapeXML(String str)