I am currently writing a LibGDX game, and I need to open an XML file for a sprite. Unfortunately, when I try to open a file, I get IOException. Files exist in the right places, the project is cleaned and updated, etc.
Here's the kicker: LibGDX will open and display the image files in the same directory and actually get the XML file in its own object FileHandle(I had it logcat size and it matches). However, when I send the file to the SAX parser, I get an exception that returns me to the file, saying that it cannot open it.
Here's the problem of the line of code inside the class ClipSprite:
private void parseConfigFile(FileHandle file) throws ParserConfigurationException, SAXException
{
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser parser = factory.newSAXParser();
XMLConfigHandler handler = new XMLConfigHandler();
try
{
parser.parse(file.path(),handler);
}
And here is the code in which I select the file in the game in the method createin the main LibGDX class
texture = new Texture(Gdx.files.internal("data/graphics/CDE1/CDE1.png"));
texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
TextureRegion region = new TextureRegion(texture, 0, 0, 512, 275);
Gdx.app.error("File","xml bytes:"+Gdx.files.internal("data/graphics/CDE1/CDE1.xml").length());
animation = new ClipSprite("data/graphics/CDE1");
Logcat error:
java.io.IOException: Couldn't open data/graphics/CDE1/CDE1.xml
, IOExceptions , ? , .