Ignore:
Timestamp:
2016-04-20T22:50:52+12:00 (8 years ago)
Author:
davidb
Message:

Changes in the Java code to support the new approach taken to client-side XSLT (using Saxon-CE JS library in the browser -- see next commit). Also some better error reporting when processing XSLT files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/XMLConverter.java

    r29728 r30477  
    9494        {
    9595            logger.error(e.getMessage());
     96            logger.error("Input string was:\n" + in);
     97            e.printStackTrace();
    9698        }
    9799        return null;
     
    113115        {
    114116            logger.error(e.getMessage());
     117            logger.error("Input string was:\n" + in);
     118            e.printStackTrace();
    115119        }
    116120        return null;
     
    131135        {
    132136            logger.error(e.getMessage(), e);
     137            logger.error("File was:\n" + in.getPath());
     138            e.printStackTrace();
    133139
    134140        }
     
    156162      {
    157163    logger.error(e.getMessage());
     164    logger.error("File was:\n" + in.getPath());
     165    e.printStackTrace();
    158166      }
    159167    return null;
     
    170178      {
    171179    logger.error(e.getMessage());
     180    logger.error("File was:\n" + in.getPath());
     181    e.printStackTrace();
    172182      }
    173183    return null;
     
    199209     
    200210      logger.error(e.getMessage());
     211      logger.error("InputSource:\n");
     212      e.printStackTrace();
    201213    }
    202214    return null;
     
    337349                xmlRepresentation.append(attribute.getNodeName());
    338350                xmlRepresentation.append("=\"");
    339                 xmlRepresentation.append(attribute.getNodeValue());
     351                String attr_val = attribute.getNodeValue();
     352               
     353                attr_val = attr_val.replaceAll("&","&");
     354                attr_val = attr_val.replaceAll("<","&lt;");
     355                attr_val = attr_val.replaceAll(">","&gt;");
     356                attr_val = attr_val.replaceAll("\"","&quot;");
     357                // assume that any of the above chars that was already entity escaped
     358                // was already correct => return back to how they were
     359                attr_val = attr_val.replaceAll("&amp;amp;","&amp;");
     360                attr_val = attr_val.replaceAll("&amp;lt;","&lt;");
     361                attr_val = attr_val.replaceAll("&amp;gt;","&gt;");
     362                attr_val = attr_val.replaceAll("&amp;quot;","&quot;");
     363               
     364               
     365                xmlRepresentation.append(attr_val);
    340366                xmlRepresentation.append("\"");
    341367            }
Note: See TracChangeset for help on using the changeset viewer.