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 escapeXml(String xmlString) {
        String result = xmlString;
        result.replaceAll("<", "&lt;");
        result.replaceAll(">", "&gt;");
        result.replaceAll("<", "&amp;");
        result.replaceAll("\"", "&quot;");
        result.replaceAll("'", "&apos;"); // &#039;
        result.replaceAll("\\", "&#092;");

        return result;
    }
}