This content has been marked as final. Show 3 replies
How can you do what?
Your title says something about finding an XML file but the body of your post suggests you want to know how to read it. A more precise question would help.
I have some XML files that are packaged in a EAR file and deployed to Websphere AppServer.
I have to find the location of these files ( relative to Webspere classes dir ) and Parse through these files.
The below code is not finding xml files (returning NULL ) and throwing Exception.
String xmlFile = "XMLDir/test.xml";
InputStream input = this.getClass().getResourceAsStream(xmlFile);
How can I find these xml files, so that I can parse through these files.
Try this instead:
The slash at the front tells the method not to treat the name as relative to the name of your class.
String xmlFile = "/XMLDir/test.xml";