1 16 package org.apache.cocoon.sitemap; 17 18 import org.w3c.dom.NodeList ; 19 20 29 public class XSLTFactoryLoader { 30 31 public String getClassSource(String className, String prefix, String pattern, NodeList conf) throws ClassNotFoundException , 32 InstantiationException , IllegalAccessException , Exception { 33 34 throw new UnsupportedOperationException ("CodeFactory is no longer supported."); 35 } 36 37 public String getParameterSource(String className, NodeList conf) throws ClassNotFoundException , InstantiationException , 38 IllegalAccessException , Exception { 39 40 throw new UnsupportedOperationException ("CodeFactory is no longer supported."); 41 } 42 43 public String getMethodSource(String className, NodeList conf) throws ClassNotFoundException , InstantiationException , 44 IllegalAccessException , Exception { 45 46 throw new UnsupportedOperationException ("CodeFactory is no longer supported."); 47 } 48 49 public boolean isFactory(String className) { 50 51 throw new UnsupportedOperationException ("Factories are no longer supported."); 52 } 53 54 58 public String escape(String string) { 59 if (string.indexOf('\\') == -1 && string.indexOf('"') == -1) { 60 return string; 62 } 63 64 StringBuffer buf = new StringBuffer (); 65 for (int i = 0; i < string.length(); i++) { 66 char ch = string.charAt(i); 67 if (ch == '\\' || ch == '"') { 68 buf.append('\\'); 69 } 70 buf.append(ch); 71 } 72 return buf.toString(); 73 } 74 75 79 public String escapeBraces(String string) { 80 if (string.indexOf("\\{") == -1) 81 { 82 return escape(string); 83 } 84 85 StringBuffer buf = new StringBuffer (); 86 for (int i = 0; i < string.length(); i++) { 87 char ch = string.charAt(i); 88 if (ch != '\\' || i >= (string.length() - 1) || string.charAt(i+1) != '{') { 89 buf.append(ch); 90 } 91 } 92 return escape(buf.toString()); 93 } 94 95 public boolean hasSubstitutions(String pattern) { 96 if (pattern.length() == 0) { 97 return false; 98 } 99 if (pattern.charAt(0) == '{') { 101 return true; 102 } 103 104 int i = 1; 106 while ((i = pattern.indexOf('{', i)) != -1) { 107 if (pattern.charAt(i-1) != '\\') { 108 return true; 109 } 110 i++; } 112 113 return false; 114 } 115 } 116 | Popular Tags |