Example usage for org.apache.solr.common.util XML escapeAttributeValue

List of usage examples for org.apache.solr.common.util XML escapeAttributeValue

Introduction

In this page you can find the example usage for org.apache.solr.common.util XML escapeAttributeValue.

Prototype

public static void escapeAttributeValue(String str, Writer out) throws IOException 

Source Link

Usage

From source file:co.diji.solr.XMLWriter.java

License:Apache License

public void writeAttr(String name, String val, boolean escape) throws IOException {
    if (val != null) {
        writer.write(' ');
        writer.write(name);// w w w  .  j av a  2  s . com
        writer.write("=\"");
        if (escape) {
            XML.escapeAttributeValue(val, writer);
        } else {
            writer.write(val);
        }
        writer.write('"');
    }
}

From source file:net.yacy.cora.federate.solr.responsewriter.EnhancedXMLResponseWriter.java

License:Open Source License

private static void writeAttr(final Writer writer, final String nameAttr, final String val) throws IOException {
    writer.write(' ');
    writer.write(nameAttr);// w w w . ja v  a 2s  .  c  o  m
    writer.write("=\"");
    XML.escapeAttributeValue(val, writer);
    writer.write('"');
}

From source file:net.yacy.cora.federate.solr.responsewriter.GrepHTMLResponseWriter.java

License:Open Source License

private static void writedd(Writer writer, String line, String grep) throws IOException {
    writer.write("<dd><a href=\"/solr/select?q=text_t:%22");
    XML.escapeAttributeValue(line, writer);
    writer.write("%22&rows=100&grep=%22");
    XML.escapeAttributeValue(grep, writer);
    writer.write("%22&wt=grephtml\">");
    XML.escapeAttributeValue(line, writer);
    writer.write("</a></dd>\n");
}

From source file:net.yacy.cora.federate.solr.responsewriter.GSAResponseWriter.java

License:Open Source License

public static void paramTag(final Writer writer, final String tagname, String value) throws IOException {
    if (value == null || value.length() == 0)
        return;/*  w w w .ja  v a 2  s  .  c o m*/
    writer.write("<PARAM name=\"");
    writer.write(tagname);
    writer.write("\" value=\"");
    XML.escapeAttributeValue(value, writer);
    writer.write("\" original_value=\"");
    XML.escapeAttributeValue(value, writer);
    writer.write("\"/>");
    writer.write(lb);
}

From source file:net.yacy.cora.federate.solr.responsewriter.HTMLResponseWriter.java

License:Open Source License

private static final void writeDoc(Writer writer, LinkedHashMap<String, String> tdoc, String title)
        throws IOException {
    writer.write("<form name=\"yacydoc" + title
            + "\" method=\"post\" action=\"#\" enctype=\"multipart/form-data\" accept-charset=\"UTF-8\">\n");
    writer.write("<fieldset>\n");

    // add a link to re-crawl this url (in case it is a remote metadata only entry)
    String sku = tdoc.get(CollectionSchema.sku.getSolrFieldName());
    final String jsc = "javascript:w = window.open('/QuickCrawlLink_p.html?indexText=on&indexMedia=on&crawlingQ=on&followFrames=on&obeyHtmlRobotsNoindex=on&obeyHtmlRobotsNofollow=off&xdstopw=on&title='+escape('"
            + title + "')+'&url='+escape('" + sku
            + "'),'_blank','height=250,width=600,resizable=yes,scrollbar=no,directory=no,menubar=no,location=no');w.focus();";
    writer.write("<div class='btn btn-default btn-sm' style='float:right' onclick=\"" + jsc
            + "\">re-crawl url</div>\n");

    writer.write("<h1 property=\"dc:Title\">" + title + "</h1>\n");
    writer.write("<dl>\n");
    for (Map.Entry<String, String> entry : tdoc.entrySet()) {
        writer.write("<dt>");
        writer.write(entry.getKey());//w w  w .ja v a  2s.  c  o m
        writer.write("</dt><dd>");
        if (entry.getKey().equals("sku")) {
            writer.write("<a href=\"" + entry.getValue() + "\">" + entry.getValue() + "</a>");
        } else {
            XML.escapeAttributeValue(entry.getValue(), writer);
        }
        writer.write("</dd>\n");
    }
    writer.write("</dl>\n");
    writer.write("</fieldset>\n");
    writer.write("</form>\n");
}

From source file:org.codelibs.elasticsearch.solr.solr.XMLWriter.java

License:Apache License

public void writeAttr(final String name, final String val, final boolean escape) throws IOException {
    if (val != null) {
        writer.write(' ');
        writer.write(name);//ww  w. ja  v a 2  s. c  om
        writer.write("=\"");
        if (escape) {
            XML.escapeAttributeValue(val, writer);
        } else {
            writer.write(val);
        }
        writer.write('"');
    }
}