本文整理了Java中org.apache.solr.common.util.XML.escapeAttributeValue()
方法的一些代码示例,展示了XML.escapeAttributeValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XML.escapeAttributeValue()
方法的具体详情如下:
包路径:org.apache.solr.common.util.XML
类名称:XML
方法名:escapeAttributeValue
暂无
代码示例来源:origin: org.dspace.dependencies.solr/dspace-solr-core
public void writeAttr(String name, String val) throws IOException {
if (val != null) {
writer.write(' ');
writer.write(name);
writer.write("=\"");
XML.escapeAttributeValue(val, writer);
writer.write('"');
}
}
代码示例来源:origin: org.dspace.dependencies.solr/dspace-solr-core
private void writeAttribute(Writer w, String name, Object value) throws IOException {
if (value == null) return;
w.write(" ");
w.write(name);
w.write("=\"");
XML.escapeAttributeValue(value.toString(), w);
w.write("\"");
}
代码示例来源:origin: mattweber/elasticsearch-mocksolrplugin
public void writeAttr(String name, String val, boolean escape) throws IOException{
if (val != null) {
writer.write(' ');
writer.write(name);
writer.write("=\"");
if(escape){
XML.escapeAttributeValue(val, writer);
} else {
writer.write(val);
}
writer.write('"');
}
}
代码示例来源:origin: org.apache.solr/solr-solrj
/** @lucene.internal */
public final static void writeXML(Writer out, String tag, Writable valWritable, Object... attrs) throws IOException {
out.write('<');
out.write(tag);
final int attrsLen = attrs == null ? 0 : attrs.length;
for (int i = 0; i< attrsLen; i++) {
out.write(' ');
out.write(attrs[i++].toString());
out.write('=');
out.write('"');
escapeAttributeValue(attrs[i].toString(), out);
out.write('"');
}
if (valWritable == null) {
out.write('/');
out.write('>');
} else {
out.write('>');
valWritable.write(out);
out.write('<');
out.write('/');
out.write(tag);
out.write('>');
}
}
代码示例来源:origin: com.hynnet/solr-solrj
/** escapes character data in val */
public static void writeXML(Writer out, String tag, String val, Map<String, String> attrs) throws IOException {
out.write('<');
out.write(tag);
for (Map.Entry<String, String> entry : attrs.entrySet()) {
out.write(' ');
out.write(entry.getKey());
out.write('=');
out.write('"');
escapeAttributeValue(entry.getValue(), out);
out.write('"');
}
if (val == null) {
out.write('/');
out.write('>');
} else {
out.write('>');
escapeCharData(val,out);
out.write('<');
out.write('/');
out.write(tag);
out.write('>');
}
}
代码示例来源:origin: org.apache.solr/solr-common
/** escapes character data in val */
public final static void writeXML(Writer out, String tag, String val, Object... attrs) throws IOException {
out.write('<');
out.write(tag);
for (int i=0; i<attrs.length; i++) {
out.write(' ');
out.write(attrs[i++].toString());
out.write('=');
out.write('"');
escapeAttributeValue(attrs[i].toString(), out);
out.write('"');
}
if (val == null) {
out.write('/');
out.write('>');
} else {
out.write('>');
escapeCharData(val,out);
out.write('<');
out.write('/');
out.write(tag);
out.write('>');
}
}
代码示例来源:origin: com.hynnet/solr-solrj
/** escapes character data in val */
public final static void writeXML(Writer out, String tag, String val, Object... attrs) throws IOException {
out.write('<');
out.write(tag);
for (int i=0; i<attrs.length; i++) {
out.write(' ');
out.write(attrs[i++].toString());
out.write('=');
out.write('"');
escapeAttributeValue(attrs[i].toString(), out);
out.write('"');
}
if (val == null) {
out.write('/');
out.write('>');
} else {
out.write('>');
escapeCharData(val,out);
out.write('<');
out.write('/');
out.write(tag);
out.write('>');
}
}
代码示例来源:origin: spaziocodice/SolRDF
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void writeResponse() throws IOException {
writer.write(XML_PROCESSING_INSTR);
final String stylesheet = req.getParams().get("stylesheet");
if (isNotNullOrEmptyString(stylesheet)) {
writer.write(XML_STYLESHEET);
escapeAttributeValue(stylesheet, writer);
writer.write(XML_STYLESHEET_END);
}
writer.write(RESPONSE_ROOT_ELEMENT_START);
final NamedList<?> responseValues = rsp.getValues();
if (req.getParams().getBool(CommonParams.OMIT_HEADER, false)) {
responseValues.remove(RESPONSE_HEADER);
} else {
((NamedList)responseValues.get(RESPONSE_HEADER)).add(Names.QUERY, responseValues.remove(Names.QUERY).toString());
}
for (final Entry<String, ?> entry : responseValues) {
writeValue(entry.getKey(), entry.getValue(), responseValues);
}
writer.write(RESPONSE_ROOT_ELEMENT_END);
}
内容来源于网络,如有侵权,请联系作者删除!