Changeset 5805 for trunk/gli/src/org/greenstone/gatherer/util
- Timestamp:
- 2003-11-07T13:20:43+13:00 (21 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer/util
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/util/Codec.java
r5707 r5805 37 37 */ 38 38 public class Codec { 39 39 40 40 static final public String DOM_TO_GREENSTONE = "DOM_TO_GREENSTONE"; 41 41 static final public String DOM_TO_TEXT = "DOM_TO_TEXT"; … … 49 49 50 50 static final private int MAX_CACHE_SIZE = 100; 51 51 52 52 static private HashMap TRANSFORMS; 53 53 static private HashMap3D CACHE; 54 54 55 55 56 56 /** Static function called to construct TRANSFORMS mappings */ 57 57 static { 58 58 TRANSFORMS = new HashMap(); 59 59 60 60 // Translate DOM encoded text into Greenstone encoding 61 61 String[] dom_to_greenstone = { … … 69 69 TRANSFORMS.put(DOM_TO_GREENSTONE, dom_to_greenstone); 70 70 dom_to_greenstone = null; 71 71 72 72 // Transform DOM encoded text into plain text 73 73 String[] dom_to_text = { … … 78 78 "<", "<", 79 79 """, "\"", 80 "&", "&" 80 "&", "&", 81 "\\|", "\\\\" 81 82 }; 82 83 TRANSFORMS.put(DOM_TO_TEXT, dom_to_text); … … 104 105 "[", "\\[", 105 106 "]", "\\]", 106 "\\ \\\\\\", "\\\\"107 "\\|", "\\\\" 107 108 }; 108 109 TRANSFORMS.put(GREENSTONE_TO_TEXT, greenstone_to_text); … … 116 117 TRANSFORMS.put(REMOVE_SQUARE_BRACKET, remove_square_bracket); 117 118 remove_square_bracket = null; 118 119 119 120 // Transform plain html text into something that can be placed in a DOM 120 121 String[] text_to_dom = { … … 123 124 ">", ">", 124 125 "\"", """, 125 "\'", "'" 126 "\'", "'", 127 "\\\\", "\\|", 126 128 }; 127 129 TRANSFORMS.put(TEXT_TO_DOM, text_to_dom); … … 130 132 // Transform plain html text into greenstone encoding 131 133 String[] text_to_greenstone = { 132 "\\\\", "\\ \\\\\\",134 "\\\\", "\\|", 133 135 "\\[", "[", 134 136 "\\]", "]", … … 192 194 static final private char UPPER_U_CHAR = 'U'; 193 195 static final private char SEMICOLON_CHAR = ';'; 194 196 195 197 static public String transformUnicode(String raw) { 196 198 StringBuffer processed = new StringBuffer(); -
trunk/gli/src/org/greenstone/gatherer/util/MetadataXML.java
r5581 r5805 32 32 import org.greenstone.gatherer.msm.ElementWrapper; 33 33 import org.greenstone.gatherer.msm.MetadataSetManager; 34 import org.greenstone.gatherer.util.StaticStrings; 34 35 import org.greenstone.gatherer.util.Utility; 35 36 import org.greenstone.gatherer.valuetree.GValueModel; … … 55 56 GValueNode node = (GValueNode)all_values.get(i); 56 57 TreePath path = new TreePath(node.getPath()); 57 String value = node.getFullPath(false); 58 String index = model.getHIndex(value); 59 String alias = node.getAlias(index); 60 if(value.indexOf(GValueModel.PATH_SEP) != -1) { 61 value = value.substring(value.lastIndexOf(GValueModel.PATH_SEP) + GValueModel.PATH_SEP.length()); 62 } 63 write(bw, "\"" + Utility.stripNL(value) + "\"\t" + index + "\t\"" + Utility.stripNL(value) + "\""); 58 String full_value = node.getFullPath(true); 59 String index = model.getHIndex(full_value); 60 61 write(bw, "\"" + Utility.stripNL(full_value) + "\"\t" + index + "\t\"" + Utility.stripNL(full_value) + "\""); 64 62 } 65 // Very important we do this, or else buffer may not have 63 // Very important we do this, or else buffer may not have 66 64 // flushed. 67 65 bw.flush(); -
trunk/gli/src/org/greenstone/gatherer/util/StaticStrings.java
r5746 r5805 128 128 static final public String OPTIONS_ATTRIBUTE = "options"; 129 129 static final public String PERL_ARGUMENT = "-perl"; 130 static final public String PIPE_STR = "|"; 130 131 static final public String PLUGIN_ELEMENT = "Plugin"; 131 132 static final public String PLUGIN_STR = "plugin";
Note:
See TracChangeset
for help on using the changeset viewer.