I use org.apache.solr.client.solrj.util.ClientUtils to convert an SolrInputDocument into a XML string and send to a queue. Now I need to manipulate that xml in a consumer, Ideally I want to have the xml convert back to SolrInputDocument, So I can add/drop couple fields with its methods. Is there an easy way to achieve that? Or any suggestions?
Asked
Active
Viewed 640 times
2 Answers
1
you can generally use something like xstream/marshall API for this...that said, the XML that is output from the ClientUtils.toXML() call doesn't work with this approach.
per this post..."this is best done programmatically"
-
I ended up going other way to get what I need. But the post you attached here is really interesting. will look at that later. thx – simonxy Nov 07 '12 at 00:39
0
The other way of doing this is to parse your xml then convert it to java class. You can use SaxParser for this. See this link.

ryacii
- 527
- 4
- 11
-
I know I can always do that in SAX, I would expect that solrj has sort of nice interface to solve this problem, 'cause I really just need to make small changes there. – simonxy Nov 06 '12 at 01:07