diff servlet/src/digilib/io/XMLMetaLoader.java @ 151:bc8df0133c04

Servlet version 1.15b1 - information in index.meta works finally for files in subdirectories.
author robcast
date Mon, 01 Sep 2003 18:21:27 +0200
parents 11cfe4c89fdc
children afe7ff98bb71
line wrap: on
line diff
--- a/servlet/src/digilib/io/XMLMetaLoader.java	Tue Aug 26 22:30:02 2003 +0200
+++ b/servlet/src/digilib/io/XMLMetaLoader.java	Mon Sep 01 18:21:27 2003 +0200
@@ -117,25 +117,25 @@
 			String localName,
 			String qName)
 			throws SAXException {
-				
+
 			String name = getName(localName, qName);
 			// exit the tag
 			tags.removeLast();
-			
-			// was it a file.name tag?
+
+			// was it a file/name tag?
 			if (name.equals(fileNameTag) && tags.contains(fileTag)) {
 				// save name as filename
-				if ((content != null)&&(content.length() > 0)) {
-					fileName = content.toString();
+				if ((content != null) && (content.length() > 0)) {
+					fileName = content.toString().trim();
 				}
 				return;
 			}
 
-			// was it a file.path tag?
+			// was it a file/path tag?
 			if (name.equals(filePathTag) && tags.contains(fileTag)) {
 				// save path as filepath 
-				if ((content != null)&&(content.length() > 0)) {
-					filePath = content.toString();
+				if ((content != null) && (content.length() > 0)) {
+					filePath = content.toString().trim();
 				}
 				return;
 			}
@@ -143,13 +143,16 @@
 			// was it a file tag?
 			if (name.equals(fileTag)) {
 				// is there meta to save?
-				if ((meta != null)&&(meta.size() > 0)) {
-					// file name is either file.path or file.name
+				if ((meta != null) && (meta.size() > 0)) {
+					// file name is (optional file/path) / file/name
 					String fn = null;
-					if (filePath != null) {
-						fn = filePath;
-					} else if (fileName != null) {
-						fn = fileName;
+
+					if (fileName != null) {
+						if (filePath != null) {
+							fn = filePath + "/" + fileName;
+						} else {
+							fn = fileName;
+						}
 					} else {
 						// no file name, no file
 						return;
@@ -163,20 +166,20 @@
 			// was it a meta tag outside a file tag?
 			if (name.equals(metaTag) && !tags.contains(fileTag)) {
 				// save meta as dir meta
-				if ((meta != null)&&(meta.size() > 0)) {
+				if ((meta != null) && (meta.size() > 0)) {
 					files.put("", meta);
 				}
 				return;
 			}
 
-			// is this inside an info tag?
+			// is this inside an info (=img) tag?
 			if (tags.contains(infoTag)) {
 				// then add whatever this is
-				if ((content != null)&&(content.length() > 0)) {
-					meta.put(name, content.toString());
+				if ((content != null) && (content.length() > 0)) {
+					meta.put(name, content.toString().trim());
 				}
 			}
-			
+
 		}
 
 	}