So I'm working on this application and writing this class to parse an xml. I've created a class that will represent my xml file, and I want to map some things for it and use the map later to extend the abilities of my parser. Heres an example:
I know that there is a DATE in every file, in the current version of XML files I'm parseing it is <date>dateValue</date>
so I want to map my generic string "DATE" to "date" so I can simply reference a data structure (map) and get the value ("date") at a key value (in this case "DATE").
If thats all I wanted to do I'd just use a hashmap. However I've added something more complicated, I have a class to represent the data that I'm pulling out of the xml, say:
public class myXML{
String date;
setDate(String input){
this.date = input;
}
}
So I'd also like to figure out a way of attaching something else with the values "DATE", "date" and now the setDate("value"). So first is there a good way of linking 2 values to one key? Second is there a good way to map to a function and then use it after? Such as
function = map.getFunctionValue("DATE");
myXML.function(someValue);
All of this is sample code so please don't comment on the lack of constructor or syntax errors :)
Thanks ahead of time!