Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    private static String encodeXML(String text) {
        String escapedXML = text;
        escapedXML = escapedXML.replaceAll("&", "&");

        escapedXML = escapedXML.replaceAll("<", "&lt;");
        escapedXML = escapedXML.replaceAll(">", "&gt;");
        escapedXML = escapedXML.replaceAll("\"", "&quot;");
        escapedXML = escapedXML.replaceAll("'", "&apos;");
        return escapedXML;
    }
}