Hi Dave, Thanks for your reply. I don't have any control over the XML file. I would try to put in HashMap as you suggested.
Regards, Santosh From: Dave Brosius [mailto:dbros...@mebigfatguy.com] Sent: Sunday, December 08, 2013 9:39 PM To: user@cassandra.apache.org Subject: Re: Parse xml and store data in Map using xom parser Not really a cassandra question, but it would seem your xml file isn't particularly well designed. It would seem you need to qualify your <test> entries with indices when put in the map, such as put("test.1.C", "0"); put("test.2.C", "5000000000"); before figuring out the cassandra angle, i'd rethink how that xml is designed if that's within your control. On 12/08/2013 10:10 AM, Santosh Shet wrote: Hi, I am trying to parse below shown XML file using xom parser in java and put each key,value pairs into Map. Later I am trying to insert this Map into Cassandra using Mutator object. My XML file looks like as below: <sample> <Max>0.25000</Max> <test> <A>Percentage</A> <B>1</B> <C>0</C> <D>2000000000</D> <E>0.25</E> </test> <test> <A>Percentage</A> <B>1</B> <C>5000000000</C> <D>7500000000</D> <E>0.15</E> </test> </sample> Currently I have HashMap<String,String> xmlData to hold elements of XML. I am traversing each child elements using getChildElements() and then retrieving element name ,element value and storing them inside HashMap. But I am facing problem while doing for the second subchild element (<test>marked in green) because it overwrites values of child elements of which I had traversed in my last iteration (<test> marked in blue) . Could somebody provide thoughts on how to store data in Cassandra in above situation. Is there any better way to it or do I need to append counter+xpath. For example, if there are 2 child elements, append <test1>+1+<A> for element <A> inside first <test> and append <test>+2+<A> for subchild of another <test> element. Thanks in advance. Best, Santosh Shet Software Engineer | VistaOne Solutions Direct India : +91 80 30273829 | Mobile India : +91 8105720582 Skype : santushet