There is a class org.apache.solr.common.util.XML in solr you can use this wrapper: public static String escapeXml(String s) throws IOException{ StringWriter sw=new StringWriter(); XML.escapeCharData(s, sw); return sw.getBuffer().toString(); }
On Wed, Mar 14, 2012 at 4:34 PM, neosky <neosk...@yahoo.com> wrote: > I use the xml to index the data. One filed might contains some characters > like '' <=> > It seems that will produce the error > I modify that filed doesn't index, but it doesn't work. I need to store the > filed, but index might not be indexed. > Thanks! > > -- > View this message in context: > http://lucene.472066.n3.nabble.com/How-to-avoid-the-unexpected-character-error-tp3824726p3824726.html > Sent from the Solr - User mailing list archive at Nabble.com. >