|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectace.xmlparsers.XMLDocumentParser
public class XMLDocumentParser
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.
Constructor Summary | |
---|---|
XMLDocumentParser()
|
Method Summary | |
---|---|
static java.lang.String |
getFileType(java.lang.String file_path)
Returns the file type of the given file. |
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 |
---|
public XMLDocumentParser()
Method Detail |
---|
public static java.lang.Object parseXMLDocument(java.lang.String file_path, java.lang.String document_type) throws java.lang.Exception
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.
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.
java.lang.Exception
- Informative exceptions are thrown if an
invalid file path is specified.public static java.lang.String getFileType(java.lang.String file_path) throws java.lang.Exception
Recogonized file types include:
file_path
- The file whose type we wish to discover.
java.lang.Exception
- If an error occurs while parsing file.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |