remove Xml Bad Symbols - Android XML

Android examples for XML:XML String

Description

remove Xml Bad Symbols

Demo Code


//package com.java2s;

public class Main {
    public static void main(String[] argv) throws Exception {
        String str = "java2s.com";
        System.out.println(removeXmlBadSymbols(str));
    }//from www. j a  v  a  2  s  .c  o m

    private static final String ERROR_SYMBOLS = "[&\\?<>\"\'\\{}@]";

    public static String removeXmlBadSymbols(String str) {
        if (str == null) {
            return "";
        }
        return str.replaceAll(ERROR_SYMBOLS, " ");
    }
}

Related Tutorials