I use stax to control xml file :
XMLStreamReader dataXML = factory.createXMLStreamReader(new FileReader(path)); while (dataXML.hasNext())