Ignore:
Timestamp:
2003-12-01T19:52:02+13:00 (20 years ago)
Author:
jmt12
Message:

Have rearranged where and how strings are feed through the Codec. After several hours work and a dozen paper trials I discovered the TEXT_TO_DOM conversion was completely pointless (DOM does it itself). Also the quotes only need to be dealt to if they are being sent to the collect.cfg file. Hopefully I've got it all going now - including using that pesky pipe character that I would rather not have to deal with. And everything seems to be ok - I tested all the dangerous characters including square brackets and amperstamp. I also tried hierarchies, and then as the piece'd'resistance I tried a hierarchies with dangerous characters. All good. I'm all about the working metadata.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/valuetree/GValueNode.java

    r6044 r6069  
    162162        return default_value;
    163163    }
    164     StringBuffer path = new StringBuffer(toString());
     164    StringBuffer path = new StringBuffer(toString(DOM));
    165165    GValueNode node = (GValueNode) getParent();
    166166    while(node != null && !node.getElement().getNodeName().equalsIgnoreCase("AssignedValues")) {
    167167        path.insert(0, StaticStrings.PIPE_STR);
    168         path.insert(0, node.toString());
     168        path.insert(0, node.toString(DOM));
    169169        node = (GValueNode) node.getParent();
    170170    }
    171171    if(as_text) {
    172         String temp = Codec.transform(path.toString(), Codec.GREENSTONE_TO_TEXT);
    173         return Codec.transform(temp, Codec.DECODE_PATH);
     172        String temp = path.toString(); ///odec.transform(path.toString(), codec.GREENSTONE_TO_TEXT);
     173        System.err.println("Raw: " + temp);
     174        temp = Codec.transform(temp, Codec.DECODE_PATH);
     175        temp = Codec.transform(temp, Codec.DECODE_SQUARE_BRACKETS);
     176        System.err.println("Decoded: " + temp);
     177        return temp;
    174178    }
    175179    else {
     
    313317    String result = null;
    314318    if(name.equals("Subject")) {
    315        result = MSMUtils.getValue(element);
    316        result = Codec.transform(result, Codec.DECODE_PATH);
    317        switch(decode_type) {
    318           case GValueNode.GREENSTONE:
    319          // We want this as greenstone format
    320          ///ystem.err.print(result);
    321          result = Codec.transform(result, Codec.DOM_TO_GREENSTONE);
    322          ///ystem.err.println(" -> D2G decode -> " + result);
    323          break;
    324           case GValueNode.TEXT:
    325          ///ystem.err.print(result);
    326          result = Codec.transform(result, Codec.DOM_TO_TEXT);
    327          ///ystem.err.println(" -> D2T decode -> " + result);
    328          break;
    329           default:
    330          ///ystem.err.println(result + " -> nothing to do.");
    331        }
     319        result = MSMUtils.getValue(element);
     320        ///ystem.err.print(result);
     321        switch(decode_type) {
     322        case GValueNode.GREENSTONE:
     323        // We want this as greenstone format
     324        ///ystem.err.print(result);
     325        //result = /odec.transform(result, /odec.DOM_TO_GREENSTONE);
     326        ///ystem.err.println(" -> D2G decode -> " + result);
     327        break;
     328        case GValueNode.TEXT:
     329        //result = /odec.transform(result, /odec.DOM_TO_TEXT);
     330        result = Codec.transform(result, Codec.DECODE_PATH);
     331        result = Codec.transform(result, Codec.DECODE_SQUARE_BRACKETS);
     332        ///ystem.err.println(" -> D2T decode -> " + result);
     333        break;
     334        default:
     335        ///ystem.err.println(result + " -> nothing to do.");
     336        }
    332337    }
    333338    else if(name.equals("AssignedValues")) {
Note: See TracChangeset for help on using the changeset viewer.