- Timestamp:
- 2004-10-08T14:25:37+13:00 (20 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/cdm/ClassifierManager.java
r8243 r8249 351 351 352 352 StringBuffer xml = Utility.readXMLStream(input_stream); 353 document = Utility.XMLStringToDOM(xml,classifier);353 document = CollectionDesignManager.XMLStringToDOM(xml,classifier); 354 354 } 355 355 catch (Exception error) { … … 436 436 { 437 437 StringBuffer xml = Utility.readXMLStream(input_stream); 438 Document document = Utility.XMLStringToDOM(xml, "-listall");438 Document document = CollectionDesignManager.XMLStringToDOM(xml, "-listall"); 439 439 440 440 // Parse XML to build up list of classifier names -
trunk/gli/src/org/greenstone/gatherer/cdm/CollectionDesignManager.java
r8243 r8249 32 32 import javax.swing.*; 33 33 import javax.swing.event.*; 34 import org.apache.xerces.parsers.*; 34 35 import org.greenstone.gatherer.Configuration; 35 36 import org.greenstone.gatherer.DebugStream; 37 import org.greenstone.gatherer.Dictionary; 36 38 import org.greenstone.gatherer.Gatherer; 37 39 import org.greenstone.gatherer.util.GSDLSiteConfig; 38 40 import org.greenstone.gatherer.util.Utility; 41 import org.w3c.dom.*; 42 import org.xml.sax.*; 39 43 40 44 /** This manager provides access to submanagers, which in turn provide tools for the designing of Greenstone collections via the information stored in etc/collect.cfg. This class acts as a hub for the managers that handle specific parts of the configuration such as classifiers, format strings and language settings. … … 242 246 243 247 248 static public Document XMLStringToDOM(StringBuffer xml, String form) 249 { 250 Document document = null; 251 252 // If something has gone horribly wrong then xml will be empty. 253 if(xml.length() > 0) { 254 try { 255 // Then read the xml from the piped input stream. 256 StringReader xml_sr = new StringReader(xml.toString()); 257 InputSource source = new InputSource(xml_sr); 258 DOMParser parser = new DOMParser(); 259 parser.parse(source); 260 document = parser.getDocument(); 261 } 262 catch (Exception error) { 263 System.err.println("Failed when trying to parse XML stream "); 264 error.printStackTrace(); 265 } 266 } 267 else { 268 //DebugStream.println("Zero length argument xml detected for: " + form); 269 String[] margs = new String[1]; 270 margs[0] = form; 271 JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("CDM.PlugInManager.PlugIn_XML_Parse_Failed", margs), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE); 272 } 273 274 return document; 275 } 276 277 244 278 private class CDMChangeListener 245 279 implements ActionListener, DocumentListener { -
trunk/gli/src/org/greenstone/gatherer/cdm/PlugInManager.java
r8243 r8249 403 403 404 404 StringBuffer xml = Utility.readXMLStream(input_stream); 405 document = Utility.XMLStringToDOM(xml,plugin);405 document = CollectionDesignManager.XMLStringToDOM(xml,plugin); 406 406 } 407 407 catch (Exception error) { … … 470 470 { 471 471 StringBuffer xml = Utility.readXMLStream(input_stream); 472 Document document = Utility.XMLStringToDOM(xml, "-listall");472 Document document = CollectionDesignManager.XMLStringToDOM(xml, "-listall"); 473 473 474 474 // Parse XML to build up list of plugin names -
trunk/gli/src/org/greenstone/gatherer/util/Utility.java
r8248 r8249 1410 1410 1411 1411 1412 static public Document XMLStringToDOM(StringBuffer xml, String form)1413 {1414 Document document = null;1415 1416 // If something has gone horribly wrong then xml will be empty.1417 if(xml.length() > 0) {1418 try {1419 // Then read the xml from the piped input stream.1420 StringReader xml_sr = new StringReader(xml.toString());1421 InputSource source = new InputSource(xml_sr);1422 DOMParser parser = new DOMParser();1423 parser.parse(source);1424 document = parser.getDocument();1425 }1426 catch (Exception error) {1427 System.err.println("Failed when trying to parse XML stream ");1428 error.printStackTrace();1429 }1430 }1431 else {1432 //DebugStream.println("Zero length argument xml detected for: " + form);1433 String[] margs = new String[1];1434 margs[0] = form;1435 JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("CDM.PlugInManager.PlugIn_XML_Parse_Failed", margs), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);1436 }1437 1438 return document;1439 }1440 1441 1442 1443 1412 /** Method to spread out a line of text so that is is justified to the given width, by attempting to widen white-spacing in a balanced way. 1444 1413 * @param original The <strong>String</strong> to justify.
Note:
See TracChangeset
for help on using the changeset viewer.