本文整理了Java中org.apache.solr.common.util.XML.writeUnescapedXML()
方法的一些代码示例,展示了XML.writeUnescapedXML()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XML.writeUnescapedXML()
方法的具体详情如下:
包路径:org.apache.solr.common.util.XML
类名称:XML
方法名:writeUnescapedXML
[英]does NOT escape character data in val, must already be valid XML
[中]不转义val中的字符数据,必须已经是有效的XML
代码示例来源:origin: org.apache.solr/solr-test-framework
/**
* Generates a delete xml string
* @param val text that has not already been xml escaped
* @param args 0 and Even numbered args are params, Odd numbered args are XML escaped values.
*/
private static String delete(String val, String... args) {
try {
StringWriter r = new StringWriter();
XML.writeUnescapedXML(r, "delete", val, (Object[]) args);
return r.getBuffer().toString();
} catch(IOException e) {
throw new RuntimeException
("this should never happen with a StringWriter", e);
}
}
代码示例来源:origin: org.dspace.dependencies.solr/dspace-solr-core
/**
* Generates an <add><doc>... XML String with options
* on the add.
*
* @param doc the Document to add
* @param args 0th and Even numbered args are param names, Odds are param values.
* @see #add
* @see #doc
*/
public String add(Doc doc, String... args) {
try {
StringWriter r = new StringWriter();
// this is anoying
if (null == args || 0 == args.length) {
r.write("<add>");
r.write(doc.xml);
r.write("</add>");
} else {
XML.writeUnescapedXML(r, "add", doc.xml, (Object[])args);
}
return r.getBuffer().toString();
} catch (IOException e) {
throw new RuntimeException
("this should never happen with a StringWriter", e);
}
}
代码示例来源:origin: org.apache.solr/solr-test-framework
/**
* Generates an <add><doc>... XML String with options
* on the add.
*
* @param doc the Document to add
* @param args 0th and Even numbered args are param names, Odds are param values.
* @see #add
* @see #doc
*/
public static String add(XmlDoc doc, String... args) {
try {
StringWriter r = new StringWriter();
// this is annoying
if (null == args || 0 == args.length) {
r.write("<add>");
r.write(doc.xml);
r.write("</add>");
} else {
XML.writeUnescapedXML(r, "add", doc.xml, (Object[])args);
}
return r.getBuffer().toString();
} catch (IOException e) {
throw new RuntimeException
("this should never happen with a StringWriter", e);
}
}
内容来源于网络,如有侵权,请联系作者删除!