Changeset 3362
- Timestamp:
- 2002-08-20T10:34:52+12:00 (22 years ago)
- Location:
- trunk/gsdl3/src/java/org/greenstone/gsdl3/util
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/util/GSFile.java
r3341 r3362 136 136 } 137 137 */ 138 139 138 140 static public String stylesheetPath(ConfigVars config, String filename) { 139 141 // try site one first … … 204 206 } 205 207 208 // this assumes that lang stuff is in its own directory - 209 //interfaces_home/translate 210 public static String getLangPath(ConfigVars config, String lang) { 211 212 return config.interfaces_home_+File.separatorChar+ 213 "translate"+File.separatorChar+lang+".xml"; 214 } 215 216 public static File getLangFile(ConfigVars config, String lang) { 217 218 return new File(config.interfaces_home_+File.separatorChar+ 219 "translate"+File.separatorChar+lang+".xml"); 220 } 206 221 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/util/GSXML.java
r3341 r3362 12 12 public class GSXML { 13 13 14 public static final String PARAM_TYPE_INTEGER = "integer"; 15 public static final String PARAM_TYPE_BOOLEAN = "boolean"; 16 public static final String PARAM_TYPE_ENUM = "enum"; 14 17 // takes a node with a resource elements inside it and extracts all the 15 18 // HASh oids - name att for resource … … 85 88 } 86 89 90 public static String getValue(Element e) { 91 String val = e.getAttribute("value"); 92 if (val ==null || val.equals("")) { 93 // have to get it out of the text 94 val=getNodeText(e); 95 96 } 97 return val; 98 } 87 99 /** extracts the text out of a node */ 88 100 public static String getNodeText(Element param) { … … 224 236 return null; //not found 225 237 } 238 239 /** takes an xpath type expression of the form name/name/... 240 and returns the first node that matches, or null if not found */ 241 public static Node getNodeByPath(Node n, String path) { 242 243 String link = GSPath.getFirstLink(path); 244 path = GSPath.removeFirstLink(path); 245 while (!link.equals("")) { 246 n = getChildByTagName(n, link); 247 if (n==null) { 248 return null; 249 } 250 link = GSPath.getFirstLink(path); 251 path = GSPath.removeFirstLink(path); 252 } 253 return n; 254 } 226 255 public static HashMap getChildrenMap(Node n) { 227 256 … … 245 274 } 246 275 276 277 public static Element createParameter(Document owner, String param_name, 278 String type, String default_value, 279 String []values) { 280 281 282 Element p = owner.createElement("param"); 283 p.setAttribute("name", param_name); 284 p.setAttribute("type", type); 285 p.setAttribute("default", default_value); 286 287 if (type.equals(PARAM_TYPE_ENUM)) { 288 for (int i=0; i<values.length; i++) { 289 Element e = owner.createElement("element"); 290 e.setAttribute("name", values[i]); 291 p.appendChild(e); 292 } 293 } 294 return p; 295 } 247 296 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/util/XMLTransformer.java
r3341 r3362 56 56 */ 57 57 public XMLTransformer() { 58 59 //System.out.println("system property="+System.getProperty("javax.xml.transform.TransformerFactory")); 60 61 System.setProperty("javax.xml.transform.TransformerFactory", "org.apache.xalan.processor.TransformerFactoryImpl"); 58 62 try { 59 t_factory_ = TransformerFactory.newInstance();63 t_factory_ = org.apache.xalan.processor.TransformerFactoryImpl.newInstance(); 60 64 61 65 } catch (Exception e) { 62 66 System.out.println("XMLTransformer() exception "+e.getMessage()); 63 67 } 68 69 //System.out.println("system property="+System.getProperty("javax.xml.transform.TransformerFactory")); 64 70 } 65 71 -
trunk/gsdl3/src/java/org/greenstone/gsdl3/util/XSLTUtil.java
r3341 r3362 6 6 public class XSLTUtil { 7 7 8 public static String toLower(String orig) {8 public static String toLower(String orig) { 9 9 return orig.toLowerCase(); 10 10 } 11 11 12 public static byte[] toUTF8(String orig) { 13 14 try { 15 byte[] utf8 = orig.getBytes("UTF-8"); 16 return utf8; 17 } 18 catch (Exception e){ 19 System.out.println("unsupported encoding"); 20 return orig.getBytes(); 21 } 22 } 23 24 public static int getInt(String orig) { 25 return 20; 26 } 27 28 public static String getString(String orig) { 29 return orig; 30 } 12 31 }
Note:
See TracChangeset
for help on using the changeset viewer.