Java examples for XML:XML Transform
transform String To Xml
// This source code is available under agreement available at //package com.java2s; public class Main { public static void main(String[] argv) throws Exception { String value = "java2s.com"; System.out.println(transformStringToXml(value)); }/*from w ww .j a v a2s. c o m*/ public static String transformStringToXml(String value) { return value .replaceAll("<", "<").replaceAll(">", ">").replaceAll("&", "&").replaceAll(""", "\"") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ .replaceAll("'", "'"); //$NON-NLS-1$ //$NON-NLS-2$ } }