Changeset 28995 for main/trunk/gli/src
- Timestamp:
- 2014-04-24T21:34:33+12:00 (10 years ago)
- Location:
- main/trunk/gli/src/org/greenstone/gatherer
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/Configuration.java
r22340 r28995 697 697 } 698 698 699 static public String getGS3BinPath() { 700 return gsdl3_src_path + "bin" + File.separator; 701 } 702 699 703 /** Remove a previously defined special directory mapping. 700 704 * @param name The name of the mapping to remove as a <strong>String</strong>. -
main/trunk/gli/src/org/greenstone/gatherer/cdm/Format4gs3Manager.java
r26356 r28995 389 389 } 390 390 391 private String removeSurro ndingTags(String xml)391 private String removeSurroundingTags(String xml) 392 392 { 393 393 return xml.replace("<ROOTELEMENT>\n", "").replace("<ROOTELEMENT>", "").replace("</ROOTELEMENT>", "").replace("<ROOTELEMENT/>",""); … … 732 732 StringBuffer sb = new StringBuffer(); 733 733 XMLTools.xmlNodeToString(sb, formatElem, true, " ", 0); 734 editor_textarea.setText(removeSurro ndingTags(sb.toString()));734 editor_textarea.setText(removeSurroundingTags(sb.toString())); 735 735 } 736 736 else … … 817 817 StringBuffer sb = new StringBuffer(); 818 818 XMLTools.xmlNodeToString(sb, formatElem, true, " ", 0); 819 editor_textarea.setText(removeSurro ndingTags(sb.toString()));819 editor_textarea.setText(removeSurroundingTags(sb.toString())); 820 820 } 821 821 else -
main/trunk/gli/src/org/greenstone/gatherer/gui/OpenCollectionDialog.java
r23238 r28995 43 43 import org.greenstone.gatherer.shell.GShellListener; 44 44 import org.greenstone.gatherer.shell.GShellProgressMonitor; 45 45 46 46 47 /** A dialog which provides a straight-forward access to the currently installed collections. It also will contain the ability to continue through to the original OpenCollectionDialog if your source collection is located somewhere other than the gsdl collect folder. */ … … 399 400 process.run(); // Don't bother threading this... yet 400 401 401 collect_cfg_file.delete(); 402 build_cfg_file.delete(); 402 // From now, won't dangerously delete GS2 collect and build config files anymore 403 //collect_cfg_file.delete(); 404 //build_cfg_file.delete(); 405 406 File collect_bak_file = new File(collection_folder.getAbsolutePath() + File.separator + "etc" + File.separator + "collect.cfg.bak"); 407 File build_bak_file = new File(collection_folder.getAbsolutePath() + File.separator+"index" + File.separator + "build.cfg.bak"); 408 if(!collect_cfg_file.renameTo(collect_bak_file)) { 409 System.err.println("Unable to move collect.cfg to " + collect_bak_file); 410 } 411 if(!build_cfg_file.renameTo(build_bak_file)) { 412 System.err.println("Unable to move build.cfg to " + build_bak_file); 413 } 403 414 } 404 415 } … … 415 426 //**************** 416 427 File collect_cfg_file = collection_configuration.getFile(); // returns the collect.cfg file 417 File etc_folder = collect_cfg_file.getParentFile(); 418 File collection_folder = etc_folder.getParentFile(); 419 filename = collection_folder.getAbsolutePath() + File.separator + "gli.col"; 420 collection_folder = null; 421 etc_folder = null; 422 collect_cfg_file = null; 423 collection_configuration = null; 428 result = FormatConversionDialog.checkForGS2FormatStatements(collect_cfg_file); 429 if(result == OK_OPTION) { // either there were no gs2 format stmts or user chose to proceed 430 File etc_folder = collect_cfg_file.getParentFile(); 431 File collection_folder = etc_folder.getParentFile(); 432 filename = collection_folder.getAbsolutePath() + File.separator + "gli.col"; 433 collection_folder = null; 434 etc_folder = null; 435 collect_cfg_file = null; 436 collection_configuration = null; 437 } 424 438 OpenCollectionDialog.this.dispose(); 425 439 } 426 440 427 Gatherer.collectDirectoryHasChanged(Gatherer.getCollectDirectoryPath(), 441 if(result == OK_OPTION) { 442 Gatherer.collectDirectoryHasChanged(Gatherer.getCollectDirectoryPath(), 428 443 newCollectPath, Gatherer.g_man.getContentPane()); 429 444 // will tell the server that the collect directory has changed and that 430 445 // the workspace needs to be refreshed (Documents in Greenstone Collections) 446 } 431 447 } 432 448 } -
main/trunk/gli/src/org/greenstone/gatherer/util/Codec.java
r8243 r28995 41 41 static final public String ENCODE_PATH = "ENCODE_PATH"; 42 42 static final public String ENCODE_SQUARE_BRACKETS = "ENCODE_SQUARE_BRACKETS"; 43 static final public String ESCAPEDHTML_TO_UNESCAPED = "ESCAPEDHTML_TO_UNESCAPED"; 43 44 static final public String GREENSTONE_TO_DOM = "GREENSTONE_TO_DOM"; 44 45 static final public String GREENSTONE_TO_TEXT = "GREENSTONE_TO_TEXT"; … … 168 169 TRANSFORMS.put(TEXT_TO_DOM, text_to_dom); 169 170 text_to_dom = null; 171 172 // Unescape html (or xml) text 173 String[] escapedhtml_to_unescaped = { 174 "&", "&", 175 "<", "<", 176 ">", ">", 177 """, "\""//, 178 //"'", "\'" 179 }; 180 TRANSFORMS.put(ESCAPEDHTML_TO_UNESCAPED, escapedhtml_to_unescaped); 181 escapedhtml_to_unescaped = null; 170 182 171 183 // Transform plain html text into greenstone encoding -
main/trunk/gli/src/org/greenstone/gatherer/util/XMLTools.java
r26354 r28995 22 22 23 23 // JAXP 24 import javax.xml.parsers.DocumentBuilder; 25 import javax.xml.parsers.DocumentBuilderFactory; 24 26 import javax.xml.parsers.FactoryConfigurationError; 25 27 import javax.xml.parsers.ParserConfigurationException; 26 28 import javax.xml.parsers.SAXParser; 27 29 import javax.xml.parsers.SAXParserFactory; 30 28 31 29 32 /** This class is a static class containing useful XML functions */ … … 331 334 static final private String HEADER = "<?xml version='1.0' encoding='UTF-8'?><collectionConfig xmlns:gsf='http://www.greenstone.org/greenstone3/schema/ConfigFormat' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>"; 332 335 static final private String FOOTER = "</collectionConfig>"; 336 337 338 public static Document getDOM(String xml_str) 339 { 340 Document doc = null; 341 try { 342 /*SAXParserFactory factory = SAXParserFactory.newInstance(); 343 factory.setNamespaceAware(true); 344 //factory.setValidating (true); 345 SAXParser parser = factory.newSAXParser(); 346 InputSource iSource = new InputSource(new StringReader(xml_str)); 347 // parser.parse (iSource, new DefaultHandler ()); 348 349 org.xml.sax.XMLReader reader = parser.getXMLReader(); 350 reader.setContentHandler(new DefaultHandler()); 351 reader.setErrorHandler(new DefaultHandler()); 352 doc = reader.parse(iSource); 353 */ 354 355 DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder(); 356 InputSource is = new InputSource(); 357 is.setCharacterStream(new StringReader(xml_str)); 358 doc = db.parse(is); 359 360 } catch (Exception e) { 361 e.printStackTrace(); 362 } 363 return doc; 364 } 333 365 334 366 public static String parse(String xml_str) … … 991 1023 public static void xmlNodeToString(StringBuffer sb, Node e, boolean indent, String indentString, int depth) 992 1024 { 993 if (e.getNodeType() == Node.TEXT_NODE) 1025 1026 if (e.getNodeType() == Node.CDATA_SECTION_NODE) 1027 { 1028 if (e.getNodeValue() != "") 1029 { 1030 String text = e.getNodeValue(); 1031 sb.append("<![CDATA["); 1032 sb.append(text); 1033 sb.append("]]>"); 1034 } 1035 return; 1036 } 1037 1038 if (e.getNodeType() == Node.TEXT_NODE) 994 1039 { 995 1040 if (e.getNodeValue() != "") … … 1057 1102 hasElements = true; 1058 1103 } 1059 if ( children.item(i).getNodeType() == Node.TEXT_NODE&& indent)1104 if ((children.item(i).getNodeType() == Node.TEXT_NODE || children.item(i).getNodeType() == Node.CDATA_SECTION_NODE) && indent) 1060 1105 { 1061 1106 if (children.item(i).getNodeValue().trim().length() > 0)
Note:
See TracChangeset
for help on using the changeset viewer.