Got a couple followup questions regarding how to handle parsing different XML file formats. What we have is a requirement to build in scalability via configurations placed in a properties file to be able to handle the following input XML file formats:
< ITEMS >
<ITEM columnName1="1" columnName2="2"/>
<COLUMN NAME="columnName1" VALUE="1"/>
<COLUMN NAME="columnName2" VALUE="2"/>
We are loading an array of linkedhashmaps based on the properties file parm that holds the array of elements expected in the web service content xml seen below
#WebService Content Node Elements
The problem we are running into is understanding what would be the better way of accessing data in the XML when dealing with each of these file formats? The thought right now is to either include a parm in the properties files or to pass as an arg at runtime to let us know which of the above 3 formats we are dealing with. Then via a case or if statements inside the loop that goes through the element names load the LinkedHashMap's to be loaded into the DB.
We have not had any trouble implementing parsing the input into and accessing the data from a DOM tree from xml formatted as Case 1 above…. just not sure how to go about handling these other XML formats? Any suggestions?