public class Test {
public static void main(String[] args) {
SAXReader reader = new SAXReader();
Document document = null;
try {
File file = new File("ip.xml");
System.out.println(file.length());
document = reader.read(file);
} catch (DocumentException e) {
e.printStackTrace();
} catch (MalformedURLException e) {
e.printStackTrace();
}
List<Element> result = document.selectNodes("//item[@begin < '3396276224' and @end > '3396276224']");
System.out.println(result.size());
}
}
=========================ip.xml=================================
<?xml version="1.0" encoding="UTF-8"?>
<root>
<item id="1" begin="2096889856" end="2096955391" cc="AU"/>
<item id="2" begin="2097037312" end="2097053695" cc="AU"/>
<item id="3" begin="2097610752" end="2097643519" cc="AU"/>
<item id="4" begin="2100953088" end="2100969471" cc="AU"/>
</root>