Android examples for XML:XML String
fix Xml String
//package com.java2s; public class Main { public static void main(String[] argv) { String sValue = "java2s.com"; System.out.println(fixXmlString(sValue)); }/*from www .jav a 2 s.c o m*/ public static String fixXmlString(String sValue) { // Change all unsafe XML characters into their safe ones String sReturnVal = sValue.replace("&", "&"); sReturnVal = sReturnVal.replace("'", "'"); sReturnVal = sReturnVal.replace("\"", """); sReturnVal = sReturnVal.replace("<", "<"); return sReturnVal.replace(">", ">"); } }