「Java」XMLのエスケープ文字列をメタ文字に変換するコード
Javaコード
public static String Escape2MetaStr(String str) {
String cftResult = “";
cftResult = str.replace(“&", “&");
cftResult = cftResult.replace(“<", “<“);
cftResult = cftResult.replace(“>", “>");
cftResult = cftResult.replace(“"", “\"");
cftResult = cftResult.replace(“'", “\'");
return cftResult;
}