Ignore:
Timestamp:
2005-06-03T14:36:41+12:00 (19 years ago)
Author:
mdewsnip
Message:

Moved Utility.parse to XMLTools.parseXMLFile, as part of tidying up the Utility class.

Location:
trunk/gli/src/org/greenstone/gatherer/util
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/util/StaticStrings.java

    r9906 r10006  
    191191    static final public String PLUGIN_STR                                 = "plugin";
    192192    static final public String PROPERTIES_FILE_EXTENSION                  = ".properties";
    193     static final public String PSEUDO_COLLECTCONFIGURATION_XML            = "xml/CollectionConfig.xml";
    194193    static final public String RANGE_ELEMENT                              = "Range";
    195194    static final public String RBRACKET_CHARACTER                         = "]";
  • trunk/gli/src/org/greenstone/gatherer/util/Utility.java

    r9981 r10006  
    10371037
    10381038
    1039     /** Parse in a xml document from a given filename. Note that this filename may need to be resolved by the class loader, especially for template files within a jar. */
    1040     static public Document parse(String filename, boolean use_classloader)
    1041     {
    1042     // Try the class loader if desired (for the applet JAR file)
    1043     if (use_classloader) {
    1044         InputStream is = base.getResourceAsStream("/" + filename);
    1045         if (is != null) {
    1046         return XMLTools.parseXML(is);
    1047         }
    1048     }
    1049 
    1050     // Try the file outside the classes directory
    1051     return XMLTools.parseXMLFile(new File(filename));
    1052     }
    1053 
    1054 
    10551039    static public StringBuffer readXMLStream(InputStream input_stream)
    10561040    {
  • trunk/gli/src/org/greenstone/gatherer/util/XMLTools.java

    r9856 r10006  
    9696    }
    9797    return child;
     98    }
     99
     100
     101    /** Parse an XML document from a given file path */
     102    static public Document parseXMLFile(String xml_file_path, boolean use_class_loader)
     103    {
     104    if (use_class_loader == true) {
     105        InputStream is = Utility.base.getResourceAsStream("/" + xml_file_path);  // !!
     106        if (is != null) {
     107        return parseXML(is);
     108        }
     109    }
     110
     111    // Try the file outside the classes directory
     112    return parseXMLFile(new File(xml_file_path));
    98113    }
    99114
Note: See TracChangeset for help on using the changeset viewer.