org.json.XML.escape()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(9.3k)|赞(0)|评价(0)|浏览(177)

本文整理了Java中org.json.XML.escape()方法的一些代码示例,展示了XML.escape()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XML.escape()方法的具体详情如下:
包路径:org.json.XML
类名称:XML
方法名:escape

XML.escape介绍

[英]Replace special characters with XML escapes:

& (ampersand) is replaced by & 
< (less than) is replaced by &lt; 
> (greater than) is replaced by &gt; 
" (double quote) is replaced by &quot;

[中]用XML转义替换特殊字符:

& (ampersand) is replaced by &amp; 
< (less than) is replaced by &lt; 
> (greater than) is replaced by &gt; 
" (double quote) is replaced by &quot;

代码示例

代码示例来源:origin: loklak/loklak_server

return XML.escape(jo.toString());
tagName = XML.escape(tagName);
sb.append('<');
sb.append(tagName);
    if (value != null) {
      sb.append(' ');
      sb.append(XML.escape(key));
      sb.append('=');
      sb.append('"');
      sb.append(XML.escape(value.toString()));
      sb.append('"');
    if (object != null) {
      if (object instanceof String) {
        sb.append(XML.escape(object.toString()));
      } else if (object instanceof JSONObject) {
        sb.append(toString((JSONObject)object));

代码示例来源:origin: loklak/loklak_server

tagName = XML.escape(tagName);
sb.append('<');
sb.append(tagName);
    if (value != null) {
      sb.append(' ');
      sb.append(XML.escape(key));
      sb.append('=');
      sb.append('"');
      sb.append(XML.escape(value.toString()));
      sb.append('"');
    if (object != null) {
      if (object instanceof String) {
        sb.append(XML.escape(object.toString()));
      } else if (object instanceof JSONObject) {
        sb.append(toString((JSONObject)object));

代码示例来源:origin: loklak/loklak_server

sb.append('\n');
          sb.append(escape(val.toString()));
          i++;
        sb.append(escape(value.toString()));
string = (object == null) ? "null" : escape(object.toString());
return (tagName == null) ? "\"" + string + "\""
    : (string.length() == 0) ? "<" + tagName + "/>" : "<" + tagName

代码示例来源:origin: b3log/latke

return XML.escape(jo.toString());
tagName = XML.escape(tagName);
sb.append('<');
sb.append(tagName);
    if (value != null) {
      sb.append(' ');
      sb.append(XML.escape(key));
      sb.append('=');
      sb.append('"');
      sb.append(XML.escape(value.toString()));
      sb.append('"');
    if (object != null) {
      if (object instanceof String) {
        sb.append(XML.escape(object.toString()));
      } else if (object instanceof JSONObject) {
        sb.append(toString((JSONObject)object));

代码示例来源:origin: b3log/latke

tagName = XML.escape(tagName);
sb.append('<');
sb.append(tagName);
    if (value != null) {
      sb.append(' ');
      sb.append(XML.escape(key));
      sb.append('=');
      sb.append('"');
      sb.append(XML.escape(value.toString()));
      sb.append('"');
    if (object != null) {
      if (object instanceof String) {
        sb.append(XML.escape(object.toString()));
      } else if (object instanceof JSONObject) {
        sb.append(toString((JSONObject)object));

代码示例来源:origin: b3log/latke

sb.append(escape(val.toString()));
        sb.append(escape(value.toString()));
string = (object == null) ? "null" : escape(object.toString());
return (tagName == null) ? "\"" + string + "\""
    : (string.length() == 0) ? "<" + tagName + "/>" : "<" + tagName

代码示例来源:origin: yacy/yacy_grid_mcp

if (as_sitesearch.length() > 0) translatedQ += (as_dt.equals("i") ? " " : " -") + "site:" + as_sitesearch;
String queryXML = XML.escape(q);
sb.append("<PARAM name=\"start\" value=\"").append(Integer.toString(start)).append("\" original_value=\"").append(Integer.toString(start)).append("\"/>\n");
sb.append("<PARAM name=\"num\" value=\"").append(Integer.toString(num)).append("\" original_value=\"").append(Integer.toString(num)).append("\"/>\n");
sb.append("<PARAM name=\"site\" value=\"").append(XML.escape(site)).append("\" original_value=\"").append(XML.escape(site)).append("\"/>\n");
for (int hitc = 0; hitc < result.size(); hitc++) {
  WebDocument doc = new WebDocument(result.get(hitc));
  String titleXML = XML.escape(doc.getTitle());
  String link = doc.getLink();
  if (Classification.ContentDomain.IMAGE == contentdom) link = doc.pickImage((String) link);
  String linkXML = XML.escape(link.toString());
  String urlhash = Digest.encodeMD5Hex(link);
  String snippet = doc.getSnippet(query.highlights.get(hitc), yq);
  String snippetXML = XML.escape(snippet);
  Date last_modified_date = doc.getDate();
  int size = doc.getSize();

代码示例来源:origin: fiber-space/jupyter-kernel-jsr223

@Override
protected void setErrorMessage() {
  StringWriter sw = new StringWriter();
  ex.getCause().printStackTrace(new PrintWriter(sw));
  String err = sw.toString();
  String[] tb = err.split("\n\n");
  String traceback;
  if (tb.length <= 2) {
    traceback = XML.escape(tb[0]);
  } else {
    traceback = XML.escape(tb[0] + "\n" + tb[1]);
  }
  //traceback = traceback.replaceAll("\n", "<br>");
  stderrWriter.write("<pre><font color=\"red\">" + traceback + "</font></pre>");
}

代码示例来源:origin: fiber-space/jupyter-kernel-jsr223

@Override
protected void setErrorMessage() {
  StringWriter sw = new StringWriter();
  ex.getCause().printStackTrace(new PrintWriter(sw));
  String err = sw.toString();
  String[] tb = err.split("\n\n");
  String traceback;
  if (tb.length <= 2) {
    traceback = XML.escape(tb[0]);
  } else {
    traceback = XML.escape(tb[0] + "\n" + tb[1]);
  }
  //traceback = traceback.replaceAll("\n", "<br>");
  stderrWriter.write("<pre><font color=\"red\">" + traceback + "</font></pre>");
}

代码示例来源:origin: de.twentyeleven.skysail/org.json-osgi

b.append(k);
b.append("=\"");
b.append(XML.escape((String)v));
b.append('"');
   stringify((JSONArray)v, b);
 } else {
   b.append(XML.escape(v.toString()));

代码示例来源:origin: com.vaadin/vaadin-shared-deps

b.append(k);
b.append("=\"");
b.append(XML.escape((String)v));
b.append('"');
   stringify((JSONArray)v, b);
 } else {
   b.append(XML.escape(v.toString()));

代码示例来源:origin: com.vaadin.external.json/json

b.append(k);
b.append("=\"");
b.append(XML.escape((String)v));
b.append('"');
   stringify((JSONArray)v, b);
 } else {
   b.append(XML.escape(v.toString()));

代码示例来源:origin: com.xmlcalabash/xmlcalabash

return XML.escape(jo.toString());
tagName = XML.escape(tagName);
sb.append('<');
sb.append(tagName);
    if (v != null) {
      sb.append(' ');
      sb.append(XML.escape(k));
      sb.append('=');
      sb.append('"');
      sb.append(XML.escape(v));
      sb.append('"');
    if (e != null) {
      if (e instanceof String) {
        sb.append(XML.escape(e.toString()));
      } else if (e instanceof JSONObject) {
        sb.append(toString((JSONObject)e));

代码示例来源:origin: org.dynamicloud.api/dynamicloud

return XML.escape(jo.toString());
tagName = XML.escape(tagName);
sb.append('<');
sb.append(tagName);
    if (value != null) {
      sb.append(' ');
      sb.append(XML.escape(key));
      sb.append('=');
      sb.append('"');
      sb.append(XML.escape(value));
      sb.append('"');
    if (object != null) {
      if (object instanceof String) {
        sb.append(XML.escape(object.toString()));
      } else if (object instanceof JSONObject) {
        sb.append(toString((JSONObject)object));

代码示例来源:origin: org.daisy.libs/com.xmlcalabash

tagName = XML.escape(tagName);
sb.append('<');
sb.append(tagName);
    if (v != null) {
      sb.append(' ');
      sb.append(XML.escape(k));
      sb.append('=');
      sb.append('"');
      sb.append(XML.escape(v));
      sb.append('"');
    if (e != null) {
      if (e instanceof String) {
        sb.append(XML.escape(e.toString()));
      } else if (e instanceof JSONObject) {
        sb.append(toString((JSONObject)e));

代码示例来源:origin: org.b3log/latke

return XML.escape(jo.toString());
tagName = XML.escape(tagName);
sb.append('<');
sb.append(tagName);
    if (value != null) {
      sb.append(' ');
      sb.append(XML.escape(key));
      sb.append('=');
      sb.append('"');
      sb.append(XML.escape(value.toString()));
      sb.append('"');
    if (object != null) {
      if (object instanceof String) {
        sb.append(XML.escape(object.toString()));
      } else if (object instanceof JSONObject) {
        sb.append(toString((JSONObject)object));

代码示例来源:origin: org.codeartisans/org.json

tagName = XML.escape(tagName);
sb.append('<');
sb.append(tagName);
    if (value != null) {
      sb.append(' ');
      sb.append(XML.escape(key));
      sb.append('=');
      sb.append('"');
      sb.append(XML.escape(value));
      sb.append('"');
    if (object != null) {
      if (object instanceof String) {
        sb.append(XML.escape(object.toString()));
      } else if (object instanceof JSONObject) {
        sb.append(toString((JSONObject)object));

代码示例来源:origin: io.snappydata/gemfire-json

tagName = XML.escape(tagName);
sb.append('<');
sb.append(tagName);
    if (value != null) {
      sb.append(' ');
      sb.append(XML.escape(key));
      sb.append('=');
      sb.append('"');
      sb.append(XML.escape(value));
      sb.append('"');
    if (object != null) {
      if (object instanceof String) {
        sb.append(XML.escape(object.toString()));
      } else if (object instanceof JSONObject) {
        sb.append(toString((JSONObject)object));

代码示例来源:origin: com.unboundid.components/json

tagName = XML.escape(tagName);
sb.append('<');
sb.append(tagName);
    if (value != null) {
      sb.append(' ');
      sb.append(XML.escape(key));
      sb.append('=');
      sb.append('"');
      sb.append(XML.escape(value));
      sb.append('"');
    if (object != null) {
      if (object instanceof String) {
        sb.append(XML.escape(object.toString()));
      } else if (object instanceof JSONObject) {
        sb.append(toString((JSONObject)object));

代码示例来源:origin: io.snappydata/gemfire-util

tagName = XML.escape(tagName);
sb.append('<');
sb.append(tagName);
    if (value != null) {
      sb.append(' ');
      sb.append(XML.escape(key));
      sb.append('=');
      sb.append('"');
      sb.append(XML.escape(value));
      sb.append('"');
    if (object != null) {
      if (object instanceof String) {
        sb.append(XML.escape(object.toString()));
      } else if (object instanceof JSONObject) {
        sb.append(toString((JSONObject)object));

相关文章