List of usage examples for org.apache.solr.common.util XML writeUnescapedXML
public final static void writeUnescapedXML(Writer out, String tag, String val, Object... attrs) throws IOException
From source file:org.alfresco.solr.AlfrescoSolrUtils.java
License:Open Source License
/** * Generates an <add><doc>... XML String with options * on the add.// ww w .j av a 2s . co m * * @param doc the Document to add * @param args 0th and Even numbered args are param names, Odds are param values. * @see #add */ 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); } }