aspose file tools*
The moose likes Java in General and the fly likes Newbie Help with JAR file containing XML files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Newbie Help with JAR file containing XML files" Watch "Newbie Help with JAR file containing XML files" New topic
Author

Newbie Help with JAR file containing XML files

John Harris
Greenhorn

Joined: Oct 20, 2005
Posts: 7
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();
while(iter.hasNext()){
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;
}
else{
// found a file
placeContent(resourceName);
}
}
}

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.
 
 
subject: Newbie Help with JAR file containing XML files