• Post Reply Bookmark Topic Watch Topic
  • New Topic

Newbie Help with JAR file containing XML files  RSS feed

John Harris
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm trying to modify an existing application which curently reads in XML validation files using the following code (path being passed in is "/WEB-INF/classes/com/oneaccount/ofm/validation/rules/"):

public static void initialise(ServletContext sc, String path) {
// intitalise the HaspMap of reource names
resources = new HashMap();

// store the original path
rootPath = path;

// start the load sequence
loadNames(path, sc);

public static void loadNames(String path, ServletContext sc){

// record the directory name removing slashes with full stops
currentDir = getPathAsDotNotation(path, rootPath);

// load the current resources
Set resourceSet = sc.getResourcePaths(path);
Iterator iter = resourceSet.iterator();
String resourceName = (String)iter.next();
if(resourceName.substring(resourceName.length() - 1).equals("/")){
// found a directory

// remember this directory name
String dirForStepDown = currentDir;

// recursive call
loadNames(resourceName, sc);

// restore previous directory name
currentDir = dirForStepDown;
// found a file

The intention in the future is to JAR up the XML files (whilst preserving the existing directory structure). I've tried numerous ways of trying to access the newly created JAR file (which is in the bin directory) but not had any success so far. Can anyone suggest any solutions. Thanks in advance.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!