Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Data Retrieving from XML file with some limitation in Java

Tags:

java

xml

I am using XML in my project for data to be Insert/Update/Delete.

Currently i am using XPath for doing the above operations from my Java application.

I am facing a problem while retrieving the data from XML. If there are 1000 records in the XML file i want to get the data from XML file with some limit (same as limit in a MySQL select query) in the rows, for implementing the pagination in the view page. I want to display 100 records at a time, so that end-user can click on next button to see all the 1000 records.

Can anyone tell me the best way to full-fill this requirement?


Ya, we can do it with "position()" function but the problem is i want to get the data in an sorted order. position() will return the data from the XML file respective to the given number(in XML file the data may not be in an order). So i want to read the data along with order. I am not able to find the XML query for Sorting and Paginated data in XPath.

like image 886
sunilkumar Avatar asked Dec 07 '25 06:12

sunilkumar


1 Answers

You can consider using JAXB instead of direct XML manipulation.

like image 142
sudmong Avatar answered Dec 08 '25 21:12

sudmong