1. merritt
  2. Untitled project
  3. mrt-core

Commits

dloy  committed 1e3682c

Cleanup entities

  • Participants
  • Parent commits 659622a
  • Branches default

Comments (0)

Files changed (3)

File core/src/main/java/org/cdlib/mrt/core/DC.java

View file
  • Ignore whitespace
 import org.cdlib.mrt.utility.LoggerInf;
 import org.cdlib.mrt.utility.StringUtil;
 import org.cdlib.mrt.utility.TException;
+import org.cdlib.mrt.utility.XMLUtil;
 import org.cdlib.mrt.utility.XSLTUtil;
 
 /**
                 fileNode = (Element)list.item(i);
                 String name = fileNode.getLocalName();
                 String content = DOMParser.getSimpleElementText(fileNode, logger);
+                content = XMLUtil.decode(content);
                 returnList.put(name, content);
             }
             return returnList;
                 fileNode = (Element)list.item(i);
                 String name = fileNode.getLocalName();
                 String content = DOMParser.getSimpleElementText(fileNode, logger);
+                content = XMLUtil.decode(content);
                 if (StringUtil.isNotEmpty(content)) {
                     returnList.put(name, content);
                 }

File core/src/main/java/org/cdlib/mrt/utility/StringUtil.java

View file
  • Ignore whitespace
 		}
 		return out.toString();
 	}
+
+
+    /**
+     * A common normalization for parms:
+     * if null or has length zero then set null
+     * if all space characters set null
+     * trim space characters
+     * @param in string to convert
+     * @return string with leading and trailing non-space
+     */
+    public static String normParm(String in)
+    {
+        if (StringUtil.isAllBlank(in)) in = null;
+        else in = in.trim();
+        return in;
+    }
 }

File core/src/main/java/org/cdlib/mrt/utility/XMLUtil.java

View file
  • Ignore whitespace
                 encodedString = encodedString.replace("'", "'");
                 encodedString = encodedString.replace(""", "\"");
 
+                encodedString = encodedString.replace("&", "&");
+                encodedString = encodedString.replace("&#60", "<");
+                encodedString = encodedString.replace("&#62;", ">");
+                encodedString = encodedString.replace("&#39;", "'");
+                encodedString = encodedString.replace("&#34;", "\"");
+
             } catch (Exception e) {
                 throw new TException.GENERAL_EXCEPTION( "XMLUtil.encodeXML: Error in encoding XML: " + xmlString);
             }