- protected String indent(int level) {
- String x = "";
- while (level-- > 0) {
- x += " ";
- }
- return x;
- }
-
- // XML Quote --
- // s/&/&/g;
- // s/</</g;
- // s/>/>/g;
- // This is hideously inefficient, but I just don't see a better
- // way using the standard JAVA library.
- //
- protected String xq(String str) {
- str = replace(str, "&", "&");
- str = replace(str, "<", "<");
- str = replace(str, ">", ">");
- return str;
- }
-
- String replace(String str, String from, String to) {
- StringBuffer sb = new StringBuffer();
- int ix; // index of next `from'
- int offset = 0; // index of previous `from' + length(from)
-
- while ((ix = str.indexOf(from, offset)) != -1) {
- sb.append(str.substring(offset, ix));
- sb.append(to);
- offset = ix + from.length();
- }
-
- // End of string: append last bit and we're done
- sb.append(str.substring(offset));
- return sb.toString();
- }
+ // Utility-function abbreviations for the use of subclasses
+ protected static String indent(int level) { return Utils.indent(level); }
+ protected static String xq(String str) { return Utils.xq(str); }