Ok, so I am still relatively new to Java and I’m making pretty good progress. My task is this:
- Build a SOAP request to initiate communicates with a web services server (done)
- Retrieve the resulting XML which contains a unique session ID which must be used in step 3 (done)
- Create another SOAP request using the unique session ID that returns another set of XML containing 100 rows of records (done)
- Extract specific data from these results (in progress)
My question is, what is the best way to store this data in Java so that I can sort through it easily? The data portion of my XML looks like this:
<RawData>
<item value="1" anothervalue="2" yetanothervalue="3"/>
<item value="4" anothervalue="5" yetanothervalue="6"/>
<item value="7" anothervalue="8" yetanothervalue="9"/>
</RawData>
I have no problem using XPath and SimpleXPathEngine to retrieve specific values from the XML. But I would really love to be able to store it in some sort of ResultSet type structure so that I could easily retrieve and manipulate it. I’ve used ResultSet with SQL queries so I’m familiar and comfortable with it, however, I’m not sure how to use it outside of an actual DB connection and query. What would be the best way to handle this?
Thanks in advance!
If the document is not that big, you can use a DOM parser to get all data in-memory. That’s either
org.w3c.dom, dom4j or jdom