I'm trying to parse a xml file in a game I'm making with libGDX. I get FileNotFoundException under circumstances below.
In a class extending DefaultHandler, I have this method to parse xml under xml/data.xml. If I place this xml folder outside the src/ directory, it works within Eclipse, but not when I export it because the folder "xml" doesn't get included in jar.
Now when I put it under src folder and specify the path as "src/xml/data.xml", it works, again only within Eclipse.
How could I find the path?
public void loadXML() throws SAXException, IOException, ParserConfigurationException {
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser parser = factory.newSAXParser();
parser.parse(Gdx.files.internal("xml/data.xml").path(), this);
}