Exactly how is a resultset getting turned into an XML file?
Are you able to parse the xml file into a DOM?
Joined: Apr 26, 2011
i want to retrieve multiple records from database using resultset in xml file.Is there any way to get no of records present from db in xml file. My requirement is below red color x value i set to manually but i need it will set using auto return value by some function or any other way in xml file.
There's no way to get the number of records that will be available from a ResultSet using regular Java. The standard way is to read the records and count them as you go along.
To put it another way, modelling a ResultSet as an array is folly. You should model it as a List. Perhaps you can do that in this XML-based language; that would be your most practical approach if you are indeed forced to use a ResultSet. However the standard way to do this sort of thing is to read all of the ResultSet rows into a List of objects in the model tier, and then process that List in the view tier. That's true even if the language used for the view tier allows you to process ResultSets.
Although it strikes me that if this tool does indeed allow you to process ResultSets, it must therefore allow you to read through the records. And since it isn't possible to know in advance the number of records, and the designers surely would have known that, it must allow you to read through the records without knowing how many there will be. Are there no examples and tutorials available?
I have been working with some xml and Java recently and I'd just like to add that in my situation, I was using Oracle also and it might be worth checking if your database can generate the xml with the row numbers as an xml attribute - certainly Oracle can produce an xml file with this embedded in it. However, as the previous post suggested, alternatively, count each record as they are output.
subject: How to know no of records resultset contains in xml file