|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
bodhidharma.xml_parsing.ParseFileHandler
bodhidharma.xml_parsing.ParseKNNFileHandler
public class ParseKNNFileHandler
An extension of the Xerces XML DefaultHandler
class that implements the SAX ContentHandler
.
The methods of this class are called by an instance of an
XMLReader
while it is parsing an XML document.
This particular implementation is custom designed to parse XML files of the BioKNearestNeighbour_file type used by the Bodhidharma music classification system. A custom exceptions is thrown if the file is not of this type. At the end of parsing, the contents of the files elements are stored in the parsed_file_contents field.
ParseFileHandler
,
Bodhidharma
,
XMLDocumentParser
,
DefaultHandler
,
ContentHandler
,
XMLReader
Field Summary |
---|
Fields inherited from class bodhidharma.xml_parsing.ParseFileHandler |
---|
parsed_file_contents |
Constructor Summary | |
---|---|
ParseKNNFileHandler()
|
Method Summary | |
---|---|
void |
characters(char[] ch,
int start,
int length)
This stores the contents of elements in the appropriate element of the fixed_fields array or in current_list. |
void |
endDocument()
This method is called when the end tag of an XML element is encountered. |
void |
endElement(java.lang.String namespace,
java.lang.String name,
java.lang.String qName)
This method is called when the end tag of an XML element is encountered. |
void |
startDocument()
This method is called when the start of the XML file to be parsed is reached. |
void |
startElement(java.lang.String namespace,
java.lang.String name,
java.lang.String qName,
org.xml.sax.Attributes atts)
This method is called when the start of an XML element is encountered. |
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
---|
endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ParseKNNFileHandler()
Method Detail |
---|
public void startDocument()
startDocument
in interface org.xml.sax.ContentHandler
startDocument
in class org.xml.sax.helpers.DefaultHandler
public void startElement(java.lang.String namespace, java.lang.String name, java.lang.String qName, org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
name
- Name of the element that is encountered.
org.xml.sax.SAXException
- Exception thrown if is wrong type of XML file.public void endElement(java.lang.String namespace, java.lang.String name, java.lang.String qName)
endElement
in interface org.xml.sax.ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
name
- Name of the element that is encountered.public void characters(char[] ch, int start, int length)
characters
in interface org.xml.sax.ContentHandler
characters
in class org.xml.sax.helpers.DefaultHandler
public void endDocument()
After this mehtod is called, entry 0 of the parsed_file_contents field will hold information in this order: number_of_categories, k, n. Entry 1 will hold an array of booleans representing features_to_use. Entry 2 will hold an array of doubles representing feature_weights. Entry 3 will hold a 2-D array of doubles representing the training_samples. Entry 4 will hold a 2-D array of ints representing the training_sample_categories.
endDocument
in interface org.xml.sax.ContentHandler
endDocument
in class org.xml.sax.helpers.DefaultHandler
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |