jAudioFeatureExtractor.ACE.XMLParsers
Class XMLDocumentParser

java.lang.Object
  extended by jAudioFeatureExtractor.ACE.XMLParsers.XMLDocumentParser

public class XMLDocumentParser
extends java.lang.Object

A holder class for the XMLDocumentParser method. This method is a general purpose method for loading an XML file, testing that the file exists, validating it as a valid XML file, ensuring that it is of the correct type, parsing it and extracting its data into the required form. Informative error exceptions are thrown in a format that can be displayed directly to users.

Custom handlers can be written to properly extract information from arbitrary XML files. The types of files currently implemented are: feature_vector_file, feature_key_file, taxonomy_file and classifications_file. See the file handlers for each of these file types for more information on the kind of data returned.

Author:
Cory McKay

Constructor Summary
XMLDocumentParser()
           
 
Method Summary
static java.lang.Object parseXMLDocument(java.lang.String file_path, java.lang.String document_type)
          This method is a general purpose method for loading an XML file, testing that the file exists, validating it as a valid XML file, ensuring that it is of the correct type, parsing it and extracting its data into the required form.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLDocumentParser

public XMLDocumentParser()
Method Detail

parseXMLDocument

public static java.lang.Object parseXMLDocument(java.lang.String file_path,
                                                java.lang.String document_type)
                                         throws java.lang.Exception
This method is a general purpose method for loading an XML file, testing that the file exists, validating it as a valid XML file, ensuring that it is of the correct type, parsing it and extracting its data into the required form. Informative error exceptions are thrown in a format that can be displayed directly to users.

Custom handlers can be written to properly extract information from arbitrary XML files. The types of files currently implemented are: feature_vector_file, feature_key_file, taxonomy_file and classifications_file. See the file handlers for each of these file types for more information on the kind of data returned.

Parameters:
file_path - The path of an XML file that will be parsed.
document_type - The type of XML file. Defined by the name of the first element in the file.
Returns:
An array of objects containing information extracted from the XML file. Object types depend on type of document parsed.
Throws:
java.lang.Exception - Informative exceptions are thrown if an invalid file path is specified.