return a string appropriate for inclusion as an XML tag
@param content to encode
@return encoded content
@deprecated use getFormatter().escapeHtml(String)
343757
public static String encodeXMLEntityQuote(final String content) {
		StringBuffer encoded = new StringBuffer(content);
		replaceAll(encoded,"amp","&#38;#38;");
		replaceAll(encoded,"apos","&#39;");
		replaceAll(encoded,"<","&#38;#60;");
		replaceAll(encoded,"gt","&#62;");
		replaceAll(encoded,"quot","&#34;");
		return encoded.toString();
	}
132988
private String unescapeHtml(Object content) {
        return content != null ? content.toString().replace("&lt;", "<").replace("&gt;", ">") : "";
    }
728968
public static Document stringToDocument(String xml) {
        try {
            SAXBuilder sax = new SAXBuilder();
            return sax.build(new ByteArrayInputStream(xml.getBytes("UTF-8")));
        } catch (JDOMException e) {
            throw new IllegalArgumentException("Unable to parse xml", e);
        } catch (IOException e) {
            throw new IllegalArgumentException("Unable to parse xml", e);
        }
    }
555285
private String escapeHtml(String html) {
    if (html == null) {
      return null;
    }
    return html.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(
        ">", "&gt;");
  }
1060510
public static String urlEncode(String content, Charset charset, TestContext context) {
        return new UrlEncodeFunction().execute(Arrays.asList(content, charset.displayName()), context);
    }
1104644
function escapeStringForJavascript(content) {
  return content.replace(/(['\\])/g, '\\$1')
    .replace(/[\f]/g, "\\f")
    .replace(/[\b]/g, "\\b")
    .replace(/[\n]/g, "\\n")
    .replace(/[\t]/g, "\\t")
    .replace(/[\r]/g, "\\r")
    .replace(/[\u2028]/g, "\\u2028")
    .replace(/[\u2029]/g, "\\u2029");
}
116096
@Nonnull
  public static String getXMLTag (final String in)
  {
    final StringBuilder aSB = new StringBuilder ();
    int pos = 1;
    if (in.charAt (1) == '/')
      pos++;
    while (Character.isLetterOrDigit (in.charAt (pos)))
      aSB.append (in.charAt (pos++));
    return aSB.toString ().toLowerCase (Locale.US);
  }
849799
public static String domToString(Node dom, boolean withXmlDeclaration)
            throws Exception {
        Transformer t = XmlTransformUtility.getTransformer();
        t.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
        if (withXmlDeclaration) {
            t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
        } else {
            t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
        }
        t.setOutputProperty(OutputKeys.METHOD, "xml");

        /* Transformer */
        StringWriter sw = new StringWriter();
        t.transform(new DOMSource(dom), new StreamResult(sw));

        return sw.toString();
    }
408410
public static String escapeHtmlAttribute(SoyValue value) {
    value = normalizeNull(value);
    if (isSanitizedContentOfKind(value, SanitizedContent.ContentKind.HTML)) {
      // |escapeHtmlAttribute should only be used on attribute values that cannot have tags.
      return stripHtmlTags(value.coerceToString(), null, true);
    }
    return escapeHtmlAttribute(value.coerceToString());
  }
658632
public static String removeHtmlTag(String content, String... tagNames) {
		return removeHtmlTag(content, true, tagNames);
	}
1287715
@Override
    public String getTagHtml(Tag tag) {

        if (CmsStringUtil.isEmpty(tag.getTagName())) {
            return "";
        }
        StringBuffer result = new StringBuffer(32);
        result.append('<');
        // Tag name is the first "Attribute"...
        Iterator itAttributes = tag.getAttributesEx().iterator();
        while (itAttributes.hasNext()) {
            result.append(itAttributes.next().toString());
            // avoid trailing whitespaces like <H1 >
            // in 2nd run htmlparser 1.5 would turn the whitespace into an Attribute with null name
            if (itAttributes.hasNext()) {
                result.append(' ');
            }
        }
        result.append('>');
        return result.toString();
    }
1279770
public String xml(String text) {
        if (text == null || text.isEmpty()) {
            return text;
        }
        return StringEscapeUtils.escapeXml11(text);
    }
373929
public String getTagHtml(Tag tag) {

        StringBuffer result = new StringBuffer(32);
        result.append('<');
        result.append(tag.getText());
        result.append('>');
        return result.toString();
    }
1155315
public static String escapeXML(final String s) {
        final char[] chars = s.toCharArray();
        return escapeXML(chars, 0, chars.length);
    }
147688
function(content) {
        var node = this.createElementNSPlus("atom:content", {
            attributes: {
                type: content.type || null
            }
        });
        if (content.src) {
            node.setAttribute("src", content.src);
        } else {
            if (content.type == "text" || content.type == null) {
                node.appendChild(
                    this.createTextNode(content.value)
                );
            } else if (content.type == "html") {
                if (typeof content.value != "string") {
                    throw "HTML content must be in form of an escaped string";
                }
                node.appendChild(
                    this.createTextNode(content.value)
                );
            } else if (content.type == "xhtml") {
                node.appendChild(content.value);
            } else if (content.type == "xhtml" ||
                           content.type.match(/(\+|\/)xml$/)) {
                node.appendChild(content.value);
            }
            else { // MUST be a valid Base64 encoding
                node.appendChild(
                    this.createTextNode(content.value)
                );
            }
        }
        return node;
    }
1292075
protected String getEncoding(String content) {

        String encoding = content;
        int index = encoding.toLowerCase().indexOf("encoding=\"");
        // encoding attribute found, get the value
        if (index != -1) {
            encoding = encoding.substring(index + 10);
            index = encoding.indexOf("\"");
            if (index != -1) {
                encoding = encoding.substring(0, index);
                return encoding.toUpperCase();
            }
        }
        // no encoding attribute found
        return "";
    }
709696
private static void serializeElement(final String tag, final String content, final ContentHandler handler)
      throws SAXException {
    final AttributesImpl attributes = new AttributesImpl();
    handler.startElement(null, tag, tag, attributes);
    handler.characters(content.toCharArray(), 0, content.length());
    handler.endElement(null, tag, tag);
  }