Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static String SPACE = " ";
    public static String QUOTE = "\"";
    public static String GT = ">";
    public static String GT_A = ">";
    public static String LT = "<";
    public static String LT_A = "&lt;";
    public static String QUOTE_A = "&quot;";
    public static String APOS = "'";
    public static String APOS_A = "&apos;";
    public static String AND = "&";
    public static String AND_A = "&amp;";
    public static String NBSP_A = "&nbsp;";

    public static String decodeXML(String XML) {

        String result = XML.replaceAll(LT_A, LT);
        result = result.replaceAll(GT_A, GT);
        result = result.replaceAll(QUOTE_A, QUOTE);
        result = result.replaceAll(APOS_A, APOS);
        result = result.replaceAll(AND_A, AND);
        result = result.replaceAll(NBSP_A, SPACE);

        /*
         * if(result.contains("amp;")){ log.severe("decodeXML Orig XML = "+XML);
         * log.severe("decodeXML Final XML = "+result); }
         */

        /*
         * if(result.contains("&")){
         * log.severe("decodeXML Final XML contains amp = "+result); }
         */
        return result;
    }
}