Changeset 18152
- Timestamp:
- 2008-12-08T17:13:33+13:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/trunk/greenstone3-extension/mat/src/org/greenstone/gsdl3_extension/mat/servlet/MatServlet.java
r18107 r18152 256 256 for (int i=0; i < identifyChildList.getLength(); i++) { 257 257 if (identifyChildList.item(i).getNodeName() == "repositoryName" ) { 258 out.println("<tr><td><strong>Repository Name:</strong></td><td> " + identifyChildList.item(i).get TextContent() + "</td></tr>");258 out.println("<tr><td><strong>Repository Name:</strong></td><td> " + identifyChildList.item(i).getNodeValue() + "</td></tr>"); 259 259 } 260 260 if (identifyChildList.item(i).getNodeName() == "baseURL" ) { 261 String baseURL = identifyChildList.item(i).getTextContent(); 261 262 Node n = identifyChildList.item(i); 263 String baseURL = getTextContent(n); 264 265 262 266 263 267 if(baseURL.startsWith("http://")){ 268 264 269 out.println("<tr><td><strong>Base URL:</strong></td><td><code><a href=\"" + baseURL + "\">" + baseURL + "</a></code></td></tr>"); 265 270 } 266 271 else{ 272 267 273 out.println("<tr><td><strong>Base URL:</strong></td><td><code><a href=\"" + oaiURLString + "\">" + oaiURLString + "</a></code></td></tr>"); 268 274 } … … 316 322 out.println("<tr><td>"); 317 323 String id = "radioID" + i; 318 String prefix = prefixList.item(i).getTextContent(); 324 325 Node n = prefixList.item(i); 326 String prefix = getTextContent(n); 327 328 //String prefix = prefixList.item(i).getNodeValue(); 319 329 320 330 if (prefix.equals("oai_dc")) { … … 410 420 } // end doPost 411 421 422 423 private static String getTextContent(Node node) { 424 Node child; 425 String sContent = node.getNodeValue() != null ? node.getNodeValue() : ""; 426 427 NodeList nodes = node.getChildNodes(); 428 for(int i = 0; i < nodes.getLength(); i++) { 429 child = nodes.item(i); 430 sContent += child.getNodeValue() != null ? child.getNodeValue() : ""; 431 if(nodes.item(i).getChildNodes().getLength() > 0) { 432 sContent += getTextContent(nodes.item(i)); 433 } 434 } 435 436 return sContent; 437 438 } 412 439 protected void buildCollection( PrintWriter out, String matShell2, String collName, String oaiURLString, String oaiPrefix) throws ServletException, IOException{ 413 440 … … 429 456 430 457 String os = "linux"; 431 if(System.getProperty("os.name").toLowerCase(). contains("windows")){432 gsdl3Home = gsdl3Home.replace ("\\", "/");458 if(System.getProperty("os.name").toLowerCase().indexOf("windows")!=-1){ 459 gsdl3Home = gsdl3Home.replaceAll("\\", "/"); 433 460 os = "windows"; 434 461 } … … 436 463 437 464 if(os.equals("windows")){ 438 gsdl3Root = gsdl3Root.replace ("/","\\");439 gsdl3Home = gsdl3Home.replace ("/", "\\");465 gsdl3Root = gsdl3Root.replaceAll("/","\\"); 466 gsdl3Home = gsdl3Home.replaceAll("/", "\\"); 440 467 } 441 468 … … 447 474 String cacheDir = gsdl3Root +fileSeparator+"ext"+fileSeparator+"mat"+fileSeparator+"tmp"+fileSeparator + collName; 448 475 449 if(System.getProperty("os.name").toLowerCase(). contains("windows")){476 if(System.getProperty("os.name").toLowerCase().indexOf("windows")!=-1){ 450 477 File wd = new File(gsdl3Root + fileSeparator + "ext" + fileSeparator + "mat" + fileSeparator + "bin" + fileSeparator +"script"); 451 478 … … 501 528 502 529 String os = "linux"; 503 if(System.getProperty("os.name").toLowerCase(). contains("windows")){504 gsdl3Home = gsdl3Home.replace ("\\", "/");530 if(System.getProperty("os.name").toLowerCase().indexOf("windows")!=-1){ 531 gsdl3Home = gsdl3Home.replaceAll("\\", "/"); 505 532 os = "windows"; 506 533 } … … 508 535 509 536 if(os.equals("windows")){ 510 gsdl3Root = gsdl3Root.replace ("/","\\");511 gsdl3Home = gsdl3Home.replace ("/", "\\");537 gsdl3Root = gsdl3Root.replaceAll("/","\\"); 538 gsdl3Home = gsdl3Home.replaceAll("/", "\\"); 512 539 } 513 540 String maxRecords = Records; … … 524 551 String matShell = ""; 525 552 526 if(System.getProperty("os.name").toLowerCase(). contains("windows")){553 if(System.getProperty("os.name").toLowerCase().indexOf("windows")!=-1){ 527 554 528 555 File wd = new File(gsdl3Root + fileSeparator + "ext" + fileSeparator + "mat" + fileSeparator + "bin" + fileSeparator +"script"); … … 653 680 while ((s = stdInput.readLine()) != null) { 654 681 stdInputBuffer.append(s+"\n"); 655 if(s. contains("-->")){656 s = s.replace ("-->", "");682 if(s.indexOf("-->")!=-1){ 683 s = s.replaceAll("-->", ""); 657 684 out.println("<!-- " + s + " -->"); 658 685 } … … 668 695 stdErrorBuffer.append(s+"\n"); 669 696 670 if(s. contains("-->")){671 s = s.replace ("-->", "");697 if(s.indexOf("-->")!=-1){ 698 s = s.replaceAll("-->", ""); 672 699 out.println("<!-- " + s + " -->"); 673 700 } … … 724 751 while ((s = stdInput.readLine()) != null) { 725 752 stdInputBuffer.append(s+"\n"); 726 if(s. contains("-->")){727 s = s.replace ("-->", "");753 if(s.indexOf("-->")!=-1){ 754 s = s.replaceAll("-->", ""); 728 755 out.println("<!-- " + s + " -->"); 729 756 } … … 739 766 stdErrorBuffer.append(s+"\n"); 740 767 741 if(s. contains("-->")){742 s = s.replace ("-->", "");768 if(s.indexOf("-->")!=-1){ 769 s = s.replaceAll("-->", ""); 743 770 out.println("<!-- " + s + " -->"); 744 771 } … … 825 852 826 853 String os = "linux"; 827 if(System.getProperty("os.name").toLowerCase(). contains("windows")){828 gsdl3Home = gsdl3Home.replace ("\\", "/");854 if(System.getProperty("os.name").toLowerCase().indexOf("windows")!=-1){ 855 gsdl3Home = gsdl3Home.replaceAll("\\", "/"); 829 856 os = "windows"; 830 857 } … … 832 859 833 860 if(os.equals("windows")){ 834 gsdl3Root = gsdl3Root.replace ("/","\\");835 gsdl3Home = gsdl3Home.replace ("/", "\\");861 gsdl3Root = gsdl3Root.replaceAll("/","\\"); 862 gsdl3Home = gsdl3Home.replaceAll("/", "\\"); 836 863 } 837 864
Note:
See TracChangeset
for help on using the changeset viewer.