Class DataFileUtils

  • public class DataFileUtils
    extends Object
    Class with some functions that can be used for working with data files.
    Jerry Vos
    • Constructor Detail

      • DataFileUtils

        public DataFileUtils()
    • Method Detail

      • loadDescriptor

        public static org.jdom.Document loadDescriptor​(String fileName)
                                                throws org.jdom.JDOMException,
        Loads in a descriptor file and returns the resulting Document. This will set the schema explicitly to the one found in the current package called SCHEMA_FILE_NAME, so the file need not have the schema specified.
        fileName - the name of the descriptor file
        a Document object corresponding to the specified descriptor file
        org.jdom.JDOMException - if there was an error inside JDOM
        IOException - if there was an error reading
        RunTimeException - if the file cannot be found
      • findBestValue

        public static String findBestValue​(Queryable queryable,
                                           org.jdom.Element nodeToHandle,
                                           String attributeName,
                                           boolean useXPath)
        Tries to retrieve an attribute from the nodeToHandle based on the target. If useXPath is true it then will query the Queryable using it's selectNode function and return the result of the Queryable's getValue on that result (or null if the result is null). If useXPath is false it will skip the XPath/Queryable steps and just return the toString of the attribute's value.
        queryable - the queryable source for fetching values from
        element - the element to fetch the target from
        attributeName - the attribute's name.
        a value as speciied
      • findExplicitTargetParent

        public static Object findExplicitTargetParent​(Queryable queryable,
                                                      String targetPath)
        queryable - the queryable source for fetching values from
        targetPath -
        a value as speciied
      • getName

        public static String getName​(String targetPath)
        targetPath -
        a value as speciied
      • isGarbage

        public static boolean isGarbage​(String string)
        Checks if a string is null or "".
        string - a string to check
        true if the string is either null or equal to ""
      • main

        public static void main​(String[] args)