In non-Android java, I used to use:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
File file = new File("res/xml/xml_sample.xml");
Document document = builder.parse(file);
Now in Android the xml seems to get into R.xml.xml_parse, at least it's defined into the R.java file. However, I can't seem to access that path to use it as the File constructor argument.
I've seen multiple solutions around which involve using getResources() like this one:
However, since this code is in a independent class which is not an Activity, it doesn't work.
Any help is appreciated.