Changeset 24007 for main/branches/64_bit_Greenstone/greenstone3/src/java/org/greenstone/gsdl3/util/XMLConverter.java
- Timestamp:
- 2011-05-09T14:37:04+12:00 (13 years ago)
- Location:
- main/branches/64_bit_Greenstone/greenstone3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/branches/64_bit_Greenstone/greenstone3
- Property svn:mergeinfo changed
-
main/branches/64_bit_Greenstone/greenstone3/src/java/org/greenstone/gsdl3/util/XMLConverter.java
r18434 r24007 41 41 import java.io.FileInputStream; 42 42 import java.io.FileReader; 43 import java.util.regex.*; 43 44 44 45 import org.apache.log4j.*; 46 47 // Apache Commons 48 import org.apache.commons.lang3.*; 49 50 import java.util.*; 51 import java.lang.reflect.*; 45 52 46 53 /** XMLConverter - utility class for greenstone … … 59 66 60 67 private static boolean outputEscaping = true; 61 62 68 63 69 /** the no-args constructor */ … … 216 222 } 217 223 224 /* For the purposes of logger.debug statements, where this is called and hence outputted, 225 returns an empty string if debugging is not enabled */ 226 public static String getPrettyStringLogger(Node xmlNode, Logger log) { 227 228 if(log.isDebugEnabled()) 229 return getPrettyString(xmlNode); 230 231 return ""; 232 233 } 234 218 235 private static void getString(Node xmlNode, StringBuffer xmlRepresentation, 219 236 int depth, boolean pretty) … … 242 259 String sid = dt.getSystemId(); 243 260 244 String doctype_str = "<!DOCTYPE " + dt.getName() + " PUBLIC \"" + pid + "\" \"" + sid + "\">\n"; 261 // Use previously assigned name, not dt.getName() again 262 String doctype_str = "<!DOCTYPE " + name + " PUBLIC \"" + pid + "\" \"" + sid + "\">\n"; 245 263 246 264 xmlRepresentation.append(doctype_str); … … 321 339 322 340 // Perform output escaping, if required 341 // Apache Commons replace method is far superior to String.replaceAll - very fast! 323 342 if (outputEscaping) { 324 text = text.replaceAll("&", "&"); // Must be done first!! 325 text = text.replaceAll("<", "<"); 326 text = text.replaceAll(">", ">"); 327 text = text.replaceAll("\"", """); 328 text = text.replaceAll("\'", "'"); 343 344 text = StringUtils.replace(text, "&", "&"); 345 text = StringUtils.replace(text, "<", "<"); 346 text = StringUtils.replace(text, ">", ">"); 347 text = StringUtils.replace(text, "'", "'"); 348 text = StringUtils.replace(text, "\"", """); 329 349 } 330 350 331 351 // Remove any control-C characters 332 text = text.replaceAll("" + (char) 3, ""); 352 text = StringUtils.replace(text, "" + (char)3, ""); 353 333 354 xmlRepresentation.append(text); 334 355 }
Note:
See TracChangeset
for help on using the changeset viewer.