I pulled two strings from a user input. I need to match one of them to the row ID.
I’m unaware of whether or not I would need to parse the Strings into integers (Perhaps even parse all of my XML data into strings, then look up that data) or if I can use the Strings to directly lookup XML data? Perhaps neither.
Here’s an example of what i’m storing in my XML file:
<?xml version="1.0" encoding="UTF-8"?>
<data>
<language>
<row id="7101">
<language-from>English</language-from>
<language-to>Thai</language-to>
<cost>30.00</cost>
<comment><![CDATA[out source]]></comment>
</row>
</language>
</data>
Looking at the XML document, I suggest you parse the XML document to a set of structured objects, store them in a map for easy lookup, where the key is your search criteria that comes from the user’s input. Unless the XML file changes too often, one-time parsing of the document is worth it than any string based searches on it.
I would define a class to hold that information as follows:
something like that…