Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6905457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:11:08+00:00 2026-05-27T08:11:08+00:00

I am working on an android application in which I want to parse an

  • 0

I am working on an android application in which I want to parse an xml file as a local resource. I use jdom to parse it, but I have a probleme, I can not open the file and I don’t know why. The error is at this line :

document = builder.build(new File("res/xml/data.xml"));

The file is located into the folder res/xml of my project. I got this error:

java.io.IOException: Couldn't open file:/res/xml/data.xml
Caused by java.io.FileNotFoundException :res/xml/data.xml

I tried this:

document = builder.build(new File("data.xml"));

but it did not work. I don’t know why the file is not found.

Would you have an idea?

Thanks in advance


Thank you for your suggestion. The ‘Uri path’ works but not the line

document = builder.build(new File(path));

The method class File must have a type entree String. I tried this:

document = builder.build(new File(path.getPath());

but it returned null and

document = builder.build(new File(path.toString());

I got the same error. Would you have an idea ?
Thanks in advance !!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:11:09+00:00Added an answer on May 27, 2026 at 8:11 am

    I believe you will need to use an URI in your file constructor that points to the data.xml file.

    Try something like this:

    Uri path = Uri.parse("android.resource://my.package.here/" + R.xml.data);
    document = builder.build(new File(path));
    

    This tutorial here might also be helpful: http://androidbook.blogspot.com/2009/08/referring-to-android-resources-using.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on an Android application in which I want to integrate foursquare
In my Android application, I want to retrieve an XML file from the internet
I am working on a file manager kind of application in android in which
I'm working on Android application which have two different tabhost : Main and Child.
I am working on an application for android and we since we have lots
I'm working on an Android app in which I would like to use multi-touch.
I am new to android development. Currently i am working on an application which
I m working on application in which i have to send all contacts from
Hi I am working Android application development using titanium studio.I have developed small application.my
I am currently working on one android application which has C2DM implementation and I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.