Android XML String Escape encodeEntities(String content)

Here you can find the source of encodeEntities(String content)

Description

encode Entities

License

Open Source License

Declaration

public static String encodeEntities(String content) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String encodeEntities(String content) {
        content = content.replace("&", "&");
        content = content.replace("<", "&lt;");
        content = content.replace(">", "&gt;");
        content = content.replace("\"", "&quot;");
        content = content.replace("'", "&apos;");
        return content;
    }/*w ww  . ja v  a2  s .  c o  m*/
}

Related

  1. toXMLString(String s)
  2. xmlEscape(String xml)
  3. escape(String input)
  4. escapeText(String rawText)
  5. getXmlEncoded(String text)
  6. encodeEntities(String content)
  7. encodeXML(final String str)
  8. XmlEscape(String value)
  9. xmlEscape(String source)