Ignore:
Timestamp:
2003-11-07T13:20:43+13:00 (21 years ago)
Author:
jmt12
Message:

Several changes needed to make pipe the hierarchy separator while keeping backslash as what the user sees

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  
    3737 */
    3838public class Codec {
    39    
     39
    4040   static final public String DOM_TO_GREENSTONE = "DOM_TO_GREENSTONE";
    4141   static final public String DOM_TO_TEXT = "DOM_TO_TEXT";
     
    4949
    5050    static final private int MAX_CACHE_SIZE = 100;
    51    
     51
    5252    static private HashMap TRANSFORMS;
    5353    static private HashMap3D CACHE;
    5454
    55    
     55
    5656    /** Static function called to construct TRANSFORMS mappings */
    5757    static {
    5858    TRANSFORMS = new HashMap();
    59    
     59
    6060    // Translate DOM encoded text into Greenstone encoding
    6161    String[] dom_to_greenstone = {
     
    6969    TRANSFORMS.put(DOM_TO_GREENSTONE, dom_to_greenstone);
    7070    dom_to_greenstone = null;
    71    
     71
    7272    // Transform DOM encoded text into plain text
    7373    String[] dom_to_text = {
     
    7878       "&lt;", "<",
    7979       "&quot;", "\"",
    80        "&amp;", "&"
     80       "&amp;", "&",
     81       "\\|", "\\\\"
    8182    };
    8283    TRANSFORMS.put(DOM_TO_TEXT, dom_to_text);
     
    104105        "&#091;", "\\[",
    105106        "&#093;", "\\]",
    106         "\\\\\\\\", "\\\\"
     107        "\\|", "\\\\"
    107108    };
    108109    TRANSFORMS.put(GREENSTONE_TO_TEXT, greenstone_to_text);
     
    116117    TRANSFORMS.put(REMOVE_SQUARE_BRACKET, remove_square_bracket);
    117118    remove_square_bracket = null;
    118    
     119
    119120    // Transform plain html text into something that can be placed in a DOM
    120121    String[] text_to_dom = {
     
    123124        ">", "&gt;",
    124125        "\"", "&quot;",
    125         "\'", "&apos;"
     126        "\'", "&apos;",
     127        "\\\\", "\\|",
    126128    };
    127129    TRANSFORMS.put(TEXT_TO_DOM, text_to_dom);
     
    130132    // Transform plain html text into greenstone encoding
    131133    String[] text_to_greenstone = {
    132         "\\\\", "\\\\\\\\",
     134        "\\\\", "\\|",
    133135        "\\[", "&#091;",
    134136        "\\]", "&#093;",
     
    192194    static final private char UPPER_U_CHAR = 'U';
    193195    static final private char SEMICOLON_CHAR = ';';
    194  
     196
    195197    static public String transformUnicode(String raw) {
    196198    StringBuffer processed = new StringBuffer();
  • trunk/gli/src/org/greenstone/gatherer/util/MetadataXML.java

    r5581 r5805  
    3232import org.greenstone.gatherer.msm.ElementWrapper;
    3333import org.greenstone.gatherer.msm.MetadataSetManager;
     34import org.greenstone.gatherer.util.StaticStrings;
    3435import org.greenstone.gatherer.util.Utility;
    3536import org.greenstone.gatherer.valuetree.GValueModel;
     
    5556        GValueNode node = (GValueNode)all_values.get(i);
    5657        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) + "\"");
    6462        }
    65         // Very important we do this, or else buffer may not have 
     63        // Very important we do this, or else buffer may not have
    6664        // flushed.
    6765        bw.flush();
  • trunk/gli/src/org/greenstone/gatherer/util/StaticStrings.java

    r5746 r5805  
    128128    static final public String OPTIONS_ATTRIBUTE                          = "options";
    129129    static final public String PERL_ARGUMENT                              = "-perl";
     130    static final public String PIPE_STR                                   = "|";
    130131    static final public String PLUGIN_ELEMENT                             = "Plugin";
    131132    static final public String PLUGIN_STR                                 = "plugin";
Note: See TracChangeset for help on using the changeset viewer.