Index: /trunk/gli/src/org/greenstone/gatherer/msm/parsers/GreenstoneMetadataParser.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/msm/parsers/GreenstoneMetadataParser.java	(revision 5152)
+++ /trunk/gli/src/org/greenstone/gatherer/msm/parsers/GreenstoneMetadataParser.java	(revision 5153)
@@ -47,4 +47,5 @@
 import org.greenstone.gatherer.msm.MSMUtils;
 import org.greenstone.gatherer.util.DecodeHTMLReader;
+import org.greenstone.gatherer.util.StaticStrings;
 import org.greenstone.gatherer.util.Utility;
 import org.greenstone.gatherer.valuetree.GValueModel;
@@ -281,5 +282,5 @@
 		if(metadatum != null) {
 		    // 6c. Try to add metadata. If there is no matching metadata element:
-		    ElementWrapper element = Gatherer.c_man.getCollection().msm.getElement(metadatum.element);
+		    ElementWrapper element = Gatherer.c_man.getCollection().msm.getElement(metadatum.element, true);
 		    // Arg. The element returned may come from the Greenstone dls, which of course should never be involved during importing. To solve check the namespace isn't "" and if it is nullify the element. Nullify. NULLIFY, Bwuhahahaha...
 		    if(element != null && element.getNamespace().equals("")) {
@@ -905,5 +906,5 @@
 	/** Retrieve the value associated with a certain index. This is harder than it first sounds as you must take into account the parent indexes of this one.
 	 * @param index The index whose value you wish to calculate, as a <strong>String</strong>.
-	 * @return The fully quantified path to the value that matches index, also as a <strong>String</strong>. Delimitiation between subject layers is denoted by the character '/'
+	 * @return The fully quantified path to the value that matches index, also as a <strong>String</strong>. Delimitiation between subject layers is denoted by the string "\\"
 	 */
 	public String getValue(String index) {
@@ -924,5 +925,5 @@
 		///ystem.err.println("\tHierarchy information required -->");
 		value.append(getValue(index.substring(0, dot_index)));
-		value.append("\\");
+		value.append(StaticStrings.ESCAPE_STR + StaticStrings.ESCAPE_STR);
 		///ystem.err.println("\t<-- Hierarchy information complete");
 	    }
Index: /trunk/gli/src/org/greenstone/gatherer/util/StaticStrings.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/util/StaticStrings.java	(revision 5152)
+++ /trunk/gli/src/org/greenstone/gatherer/util/StaticStrings.java	(revision 5153)
@@ -33,4 +33,5 @@
 public class StaticStrings {
     static final public char   NEW_LINE_CHARACTER                         = '\n';
+    static final public char   STAR_CHAR                                  = '*';
     static final public String ALLFIELDS_STR                              = "allfields";
     static final public String ARCPLUG_STR                                = "ArcPlug";
@@ -38,4 +39,5 @@
     static final public String AT_CHARACTER                               = "@";
     static final public String CCS_STR                                    = "ccs";
+    static final public String CLASSES_FOLDER                             = "classes";
     static final public String CLASSIFY_ELEMENT                           = "Classify";
     static final public String CLASSIFY_STR                               = "classify";
@@ -66,7 +68,10 @@
     static final public String CUSTOM_ATTRIBUTE                           = "custom";
     static final public String DEBUG_ARGUMENT                             = "-debug";
+    static final public String DICTIONARY_FILENAME                        = "dictionary";
     static final public String EMPTY_STR                                  = "";
     static final public String ENGLISH_LANGUAGE_STR                       = "en";
     static final public String ENUM_STR                                   = "enum";
+    static final public String ESCAPE_PATTERN                             = "\\\\";
+    static final public String ESCAPE_STR                                 = "\\";
     static final public String EXCLAIMATION_CHARACTER                     = "!";
     static final public String EXCLUDE_STR                                = "exclude";
@@ -77,7 +82,9 @@
     static final public String FORMAT_STR                                 = "format";
     static final public String GSDL_ARGUMENT                              = "-gsdl";
+    static final public String HIERARCHY_ATTRIBUTE                        = "hierarchy";
     static final public String HIERARCHY_STR                              = "hierarchy";
     static final public String HTTP_PROTOCOL_STR                          = "http://";
     static final public String HELP_ARGUMENT                              = "-help";
+    static final public String IMPORT_FOLDER                              = "import";
     static final public String INCLUDE_STR                                = "include";
     static final public String INDEX_ELEMENT                              = "Index";
@@ -96,4 +103,5 @@
     static final public String LANGUAGES_STR                              = "languages";
     static final public String LBRACKET_CHARACTER                         = "[";
+    static final public String LBRACKET_PATTERN                           = "\\[";
     static final public String LEVEL_ATTRIBUTE                            = "level";
     static final public String LEVELS_ELEMENT                             = "Levels";
@@ -103,4 +111,5 @@
     static final public String LOAD_ARGUMENT                              = "-load";
     static final public String METADATA_ARGUMENT                          = "-metadata";
+    static final public String METADATA_SET_EXTENSION                     = ".mds";
     static final public String METADATA_STR                               = "metadata";
     static final public String METADATA_TYPE_STR                          = "metadatum"; // Because -someone- complained we have metadata (plural) and metadatum (singular) confused...
@@ -109,4 +118,5 @@
     static final public String MGPP_ATTRIBUTE                             = "mgpp_enabled";
     static final public String MINUS_CHARACTER                            = "-";
+    static final public String MODEL_COLLECTION_NAME                      = "modelcol";
     static final public String NAME_ATTRIBUTE                             = "name";
     static final public String NEWLINE_CHARACTER                          = "\\";
@@ -118,7 +128,9 @@
     static final public String PLUGIN_ELEMENT                             = "Plugin";
     static final public String PLUGIN_STR                                 = "plugin";
+    static final public String PROPERTIES_FILE_EXTENSION                  = ".properties";
     static final public String PSEUDO_COLLECTCONFIGURATION_XML            = "xml/CollectionConfig.xml";
     static final public String QUOTE_CHARACTER                            = "\"";
     static final public String RBRACKET_CHARACTER                         = "]";
+    static final public String RBRACKET_PATTERN                           = "\\]";
     static final public String RECPLUG_STR                                = "RecPlug";
     static final public String SEARCHTYPE_ELEMENT                         = "SearchType";
@@ -127,4 +139,5 @@
     static final public String SEPARATOR_CHARACTER                        = "/";
     static final public String SKIN_ARGUMENT                              = "-skinlf";
+    static final public String SINGLE_ESCAPE_ONLY_PATTERN                 = "[^\\\\]+\\\\[^\\\\]+";
     static final public String SPACE_CHARACTER                            = " ";
     static final public String SPECIAL_ATTRIBUTE                          = "special";
@@ -143,6 +156,9 @@
     static final public String TRUE_STR                                   = "true";
     static final public String TYPE_ATTRIBUTE                             = "type";
+    static final public String UNDERSCORE_CHARACTER                       = "_";
     static final public String UNKNOWN_ELEMENT                            = "Unknown";
+    static final public String USE_METADATA_FILES_ARGUMENT                = "use_metadata_files";
     static final public String URL_SEPARATOR_CHARACTER                    = "/";
     static final public String VALUE_ATTRIBUTE                            = "value";
+    static final public String VALUE_TREE_ATTRIBUTE                       = "remember_values";
 }
Index: /trunk/gli/src/org/greenstone/gatherer/util/Utility.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/util/Utility.java	(revision 5152)
+++ /trunk/gli/src/org/greenstone/gatherer/util/Utility.java	(revision 5153)
@@ -53,4 +53,6 @@
  */
 public class Utility {
+    static final public Dimension BUTTON_SIZE = new Dimension(160, 35);
+    static final public Dimension LABEL_SIZE = new Dimension(125, 35);
     /** The default size of a gatherer progress bar, in either the download view or the build view. */
     static final public Dimension PROGRESS_BAR_SIZE = new Dimension(580,65);
@@ -102,10 +104,10 @@
     static final public String GREENSTONEDIRECTORYMETADATA_TEMPLATE = "xml/metadata.xml";
     /** Definition of an important directory name, in this case the private web cache directory for the collection. */
-    static final public String GCACHE_DIR = "gcache" + File.separator;
+    static final public String GCACHE_DIR = "cache" + File.separator;
     static final public String GLI_ARCHIVE = "GLI.jar";
     /** Definition of an important directory name, in this case the location of help documentation. */
     static final public String HELP_DIR = BASE_DIR + "help" + File.separator;
     /** Definition of an important directory name, in this case the import directory for the collection. */
-    static final public String IMPORT_DIR = "gimport" + File.separator;
+    static final public String IMPORT_DIR = "import" + File.separator;
     /** Definition of an important directory name, in this case the index directory for the collection. */
     static final public String INDEX_DIR = "index" + File.separator;
@@ -117,5 +119,4 @@
     /** Definition of an important directory name, in this case the location of the default metadata sets. */
     static final public String METADATA_DIR = BASE_DIR + "metadata" + File.separator;
-    static final public String METADATA_EXTRACTED = "extracted.mds";
     /** The location the gatherer expects to find metadata set information. */
     static final public String METADATA_SET_TEMPLATE = "xml/template.mds";
@@ -123,6 +124,4 @@
     static final public String METADATA_XML = "metadata.xml";
     static final public String NAME_ELEMENT = "Name";
-    /** Definition of an important directory name, in this case the import directory for the collection. */
-    static final public String OLD_IMPORT_DIR = "import" + File.separator;
     /** The default name of the perl executable under unix. */
     static final public String PERL_EXECUTABLE_UNIX = "perl";
@@ -196,17 +195,4 @@
 	return new TreePath(temp);
     }
-    /** Decodes a string of text so its safe to use in a Greenstone configuration file. Esentially replaces "\n" with a newline.
-     * @param raw The <strong>String</strong> before decoding, read from the configuration file..
-     * @return A <strong>String</strong> ready to be placed in a component.
-     */
-    static public String decodeGreenstone(String raw) {
-	raw = raw.replaceAll("&apos;", "\'");
-	raw = raw.replaceAll("&gt;", ">");
-	raw = raw.replaceAll("&lt;", "<");
-	raw = raw.replaceAll("&quot;", "\"");
-	raw = raw.replaceAll("&#39;", "\'");
-	raw = raw.replaceAll("\\\\n", "\n");
-	return raw;
-    }
     /** Takes a rfc2616 'safe' String and translates it back into its 'unsafe' form. Basically the native c wget decode_string() function, but without pointer stuff. If searches through the String looking for the pattern %xy where x and y are hexidecimal digits and where xy maps to a character.<BR> If x or y are not hexidecimal or % is followed by a \0 then the pattern is left as is.
      * @param encoded The url-safe <strong>String</strong> to be decoded.
@@ -263,8 +249,97 @@
      * @return A <strong>String</strong> which is safe to write to the configuration file.
      */
+    static final private char AMPERSTAMP_CHAR = '&';
+    static final private char ESCAPE_CHAR = '\\';
+    static final private char GREATER_THAN_CHAR = '>';
+    static final private char LESS_THAN_CHAR = '<';
+    static final private char NEWLINE_CHAR = '\n';
+    static final private char QUOTE_CHAR = '\'';
+    static final private char SPEECH_CHAR = '\"';
+    static final private String ENCODED_AMPERSTAMP_STR = "&amp;";
+    static final private String ENCODED_GREATER_THAN_STR = "&gt;";
+    static final private String ENCODED_LESS_THAN_STR = "&lt;";
+    static final private String ENCODED_SPEECH_STR = "&quot;";
+    static final private String ESCAPED_NEWLINE_STR = "\\n";
+
+    /** Decodes a string of text so its safe to use in a Greenstone configuration file. Esentially replaces "\n" with a newline.
+     * @param raw The <strong>String</strong> before decoding, read from the configuration file..
+     * @return A <strong>String</strong> ready to be placed in a component.
+     */
+    static public String decodeGreenstone(String raw) {
+	raw = raw.replaceAll("&apos;", "\'");
+	raw = raw.replaceAll("&gt;", ">");
+	raw = raw.replaceAll("&lt;", "<");
+	raw = raw.replaceAll("&quot;", "\"");
+	raw = raw.replaceAll("&#39;", "\'");
+	raw = raw.replaceAll("\\\\n", "\n");
+	return raw;
+    }
+
     static public String encodeGreenstone(String raw) {
-	raw = raw.replaceAll("<", "&lt;");
-	raw = raw.replaceAll(">", "&gt;");
-	return raw.replaceAll("\n", "\\\\n");
+	// Once again regex fails to provide the power necessary for me to change strings. What I need to do is replace "<" and ">" with "&lt;" and "&gt;", and replace "\<" and "\>" with "<" and ">".
+	StringBuffer processed = new StringBuffer();
+	int index = 0;
+	while(index < raw.length()) {
+	    char c = raw.charAt(index);
+	    switch(c) {
+		// Replace a normal new line character with "\n"
+	        case NEWLINE_CHAR:
+		    processed.append(ESCAPED_NEWLINE_STR);
+		    break;
+		// Replace "\<" with "<", or with "\&lt;" if this is for XML. Similar requirements for "\>".
+	        case ESCAPE_CHAR:
+		    if(index + 1 < raw.length()) {
+			char d = raw.charAt(index + 1);
+			if(d == LESS_THAN_CHAR) {
+			    processed.append(LESS_THAN_CHAR);
+			    index++;
+			    break;
+			}
+			else if(d == GREATER_THAN_CHAR) {
+			    processed.append(GREATER_THAN_CHAR);
+			    index++;
+			    break;
+			}
+		    }
+		    // I have no idea how this would happen, but I better watch for it anyway
+		    processed.append(c);
+		    break;
+		// Replace "<" with "&lt;"
+	        case LESS_THAN_CHAR:
+		    processed.append(ENCODED_LESS_THAN_STR);
+		    break;
+		// Replace ">" with "&gt;"
+	        case GREATER_THAN_CHAR:
+		    processed.append(ENCODED_GREATER_THAN_STR);
+		    break;
+	        default:
+		    processed.append(c);
+	    }
+	    index++;
+	}
+	return processed.toString();
+    }
+    /** When retrieve text for, or from the collect.cfg file it may contain characters that can't go into a DOM such as "<" and ">". We also might already have encoded versions "&lt;" and "&gt;". Thus we must encode the former, and double encode the latter. */
+    static public String encodeXML(String raw) {
+	StringBuffer processed = new StringBuffer();
+	int index = 0;
+	while(index < raw.length()) {
+	    char c = raw.charAt(index);
+	    switch(c) {
+	    case GREATER_THAN_CHAR:
+		processed.append(ENCODED_GREATER_THAN_STR);
+		break;
+	    case LESS_THAN_CHAR:
+		processed.append(ENCODED_LESS_THAN_STR);
+		break;
+	    case AMPERSTAMP_CHAR:
+		processed.append(ENCODED_AMPERSTAMP_STR);
+		break;
+	    default:
+		processed.append(c);
+	    }
+	    index++;
+	}
+	return processed.toString();
     }
 
Index: /trunk/gli/src/org/greenstone/gatherer/valuetree/GValueModel.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/valuetree/GValueModel.java	(revision 5152)
+++ /trunk/gli/src/org/greenstone/gatherer/valuetree/GValueModel.java	(revision 5153)
@@ -42,4 +42,5 @@
 import org.greenstone.gatherer.msm.MetadataSetManager;
 import org.greenstone.gatherer.msm.MSMUtils;
+import org.greenstone.gatherer.util.StaticStrings;
 import org.greenstone.gatherer.util.SynchronizedTreeModelTools;
 import org.greenstone.gatherer.util.Utility;
@@ -80,14 +81,43 @@
     }
 
-    /** Value may include path ie news/newssw */
+    /** Value may include path ie news\newssw */
     public GValueNode addValue(String value) {
-	StringTokenizer tokenizer = new StringTokenizer(value, "\\");
-	GValueNode subject = (GValueNode) root;
-	while(tokenizer.hasMoreTokens() && subject != null) {
-	    String token = tokenizer.nextToken();
-	    subject = addValue(token, subject, null);
-	    ///ystem.err.println("Found or created a node " + token);
-	}
-	return subject;
+	try {
+	    // Remove any single escape characters
+	    value = stripEscapes(value);
+	    // Now we can tokenize the string using the double escaped characters
+	    StringTokenizer tokenizer = new StringTokenizer(value, StaticStrings.ESCAPE_STR);
+	    GValueNode subject = (GValueNode) root;
+	    while(tokenizer.hasMoreTokens() && subject != null) {
+		String token = tokenizer.nextToken();
+		subject = addValue(token, subject, null);
+	    }
+	    return subject;
+	}
+	catch (Exception error) {
+	    error.printStackTrace();
+	}
+	return null;
+    }
+
+    /** Replace all current double escapes with single escapes, and remove all currently single escapes. */
+    static final private char ESCAPE_CHARACTER = '\\';
+    private String stripEscapes(String raw) {
+	StringBuffer processed_buffer = new StringBuffer();
+	int raw_length = raw.length();
+	for(int i = 0; i < raw_length; i++) {
+	    char c = raw.charAt(i);
+	    switch(c) {
+	    case ESCAPE_CHARACTER:
+		if(i < raw_length - 1 && raw.charAt(i+1) == ESCAPE_CHARACTER) {
+		    i = i + 1;
+		    processed_buffer.append(c);
+		}
+		break;
+	    default:
+		processed_buffer.append(c);
+	    }
+	}
+	return processed_buffer.toString();
     }
 
@@ -245,4 +275,5 @@
     }
 
+    /**
     public void updateValue(String new_value, String old_value) {
 	///ystem.err.println("Updating '" + old_value + "' to '" + new_value + "'"); 
@@ -254,4 +285,5 @@
 	}
     }
+    */
 
     /** Called to update a certain value of metadata within a specific
@@ -294,6 +326,6 @@
 		}
 		value = value.substring(next.toString().length());
-		if(value.startsWith("\\")) {
-		    value = value.substring(1);
+		if(value.startsWith(StaticStrings.ESCAPE_STR + StaticStrings.ESCAPE_STR)) {
+		    value = value.substring(2);
 		    index = getHIndex(next, value, index);
 		}
Index: /trunk/gli/src/org/greenstone/gatherer/valuetree/GValueNode.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/valuetree/GValueNode.java	(revision 5152)
+++ /trunk/gli/src/org/greenstone/gatherer/valuetree/GValueNode.java	(revision 5153)
@@ -35,10 +35,4 @@
  *########################################################################
  */
-
- 
-
-
-
-
 package org.greenstone.gatherer.valuetree;
 /**
@@ -61,4 +55,5 @@
 import org.greenstone.gatherer.msm.ElementWrapper;
 import org.greenstone.gatherer.msm.MSMUtils;
+import org.greenstone.gatherer.util.StaticStrings;
 import org.greenstone.gatherer.util.Utility;
 import org.w3c.dom.Document;
@@ -188,6 +183,9 @@
 	GValueNode node = (GValueNode) getParent();
 	while(node != null && !node.getElement().getNodeName().equalsIgnoreCase("AssignedValues")) {
-	    path.insert(0, "\\");
-	    path.insert(0, node.toString());
+	    path.insert(0, StaticStrings.ESCAPE_STR + StaticStrings.ESCAPE_STR);
+	    String temp = node.toString();
+	    temp = temp.replaceAll(StaticStrings.LBRACKET_PATTERN, StaticStrings.ESCAPE_PATTERN + StaticStrings.LBRACKET_PATTERN);
+	    temp = temp.replaceAll(StaticStrings.RBRACKET_PATTERN, StaticStrings.ESCAPE_PATTERN + StaticStrings.RBRACKET_PATTERN);
+	    path.insert(0, temp);
 	    node = (GValueNode) node.getParent();
 	}
