|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
org.optimizationservices.oscommon.representationparser.FMLHandler
public class FMLHandler
The FMLHandler
class is derived from the SAX DefaultHandler
class. When the SAX parser encounter the start and end of elements, methods
in FMLHandler are called. These methods return values for the element
attributes and text content. These data are then used in the arguments for
methods such as onConstraints in the class FMLReader
.
FMLReader
,
DefaultHandler
Constructor Summary | |
---|---|
FMLHandler(FMLReader fmlParser)
constructor of FMLHandler. |
Method Summary | |
---|---|
void |
characters(char[] ch,
int start,
int length)
Receive notification of character data. |
void |
endDocument()
Receive notification of the end of a document. |
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
Receive notification of the end of an element. |
void |
error(org.xml.sax.SAXParseException e)
Receive notification of a recoverable error. |
void |
fatalError(org.xml.sax.SAXParseException e)
Receive notification of a non-recoverable error. |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Receive notification of ignorable whitespace in element content. |
static void |
main(java.lang.String[] argv)
main for test purposes. |
void |
processingInstruction(java.lang.String target,
java.lang.String data)
Receive notification of a processing instruction. |
void |
startDocument()
Receive notification of the beginning of a document. |
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes attributes)
Receive notification of the beginning of an element. |
void |
warning(org.xml.sax.SAXParseException e)
Receive notification of a warning. |
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
---|
endPrefixMapping, notationDecl, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FMLHandler(FMLReader fmlParser)
fmlParser
- The FML Parser that registers this handler.Method Detail |
---|
public void warning(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException
SAX parsers will use this method to report conditions that are not errors or fatal errors as defined by the XML 1.0 recommendation. The implemented behavior is to print the xml style warning message and set the warning flag true.
The SAX parser will continue to provide normal parsing events after invoking this method: it should still be possible for the application to process the document through to the end.
warning
in interface org.xml.sax.ErrorHandler
warning
in class org.xml.sax.helpers.DefaultHandler
e
- The warning information encapsulated in a SAX parse exception.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.SAXParseException
,
ErrorHandler.warning(org.xml.sax.SAXParseException)
public void error(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException
This corresponds to the definition of "error" in section 1.2 of the W3C XML 1.0 Recommendation such as a validity constraint. The implemented behavior is to print the xml style error message and set the error flag true.
The SAX parser will continue to provide normal parsing events after invoking this method: it should still be possible for the application to process the document through to the end. If the application cannot do so, then the parser will report a fatal error.
error
in interface org.xml.sax.ErrorHandler
error
in class org.xml.sax.helpers.DefaultHandler
exception
- The error information encapsulated in a SAX parse exception.
org.xml.sax.SAXException
- Any SAX exception, possibly wrapping
another exception.SAXParseException
,
ErrorHandler.error(org.xml.sax.SAXParseException)
public void fatalError(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException
This corresponds to the definition of "fatal error" in section 1.2 of the W3C XML 1.0 Recommendation, such as a well-formedness constraint.The implemented behavior is to print the xml style error message and set the fatalError flag true.
The application will assume that the document is unusable after the parser has invoked this method, and will continue (if at all) only for the sake of collecting addition error messages: in fact, SAX parsers are free to stop reporting any other events once this method has been invoked.
fatalError
in interface org.xml.sax.ErrorHandler
fatalError
in class org.xml.sax.helpers.DefaultHandler
exception
- The error information encapsulated in a SAX parse exception.
org.xml.sax.SAXException
- Any SAX exception, possibly wrapping
another exception.SAXParseException
,
ErrorHandler.fatalError(org.xml.sax.SAXParseException)
public void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException
The Parser will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element.
The implemented method uses the default behavior from the super
class DefaultHandler
processingInstruction
in interface org.xml.sax.ContentHandler
processingInstruction
in class org.xml.sax.helpers.DefaultHandler
target
- The processing instruction target.data
- The processing instruction data, or null if none was supplied.
The data does not include any whitespace separating it from the target.
org.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.ContentHandler.processingInstruction(java.lang.String, java.lang.String)
public void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
The implemented method uses the default behavior from the super
class DefaultHandler
ignorableWhitespace
in interface org.xml.sax.ContentHandler
ignorableWhitespace
in class org.xml.sax.helpers.DefaultHandler
ch
- The characters from the XML document.start
- The start position in the array.length
- The number of characters to read from the array.
org.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.characters(char[], int, int)
,
ContentHandler.ignorableWhitespace(char[], int, int)
public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
The method stores the current characters in a string corresponding to each of the following element, to be processed later.
characters
in interface org.xml.sax.ContentHandler
characters
in class org.xml.sax.helpers.DefaultHandler
ch
- The characters from the XML document.start
- The start position in the array.length
- The number of characters to read from the array.
org.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.ignorableWhitespace(char[], int, int)
,
Locator
,
ContentHandler.characters(char[], int, int)
public void startDocument() throws org.xml.sax.SAXException
The SAX parser will invoke this method only once, before any
other methods in this interface or in DTDHandler
(except for setDocumentLocator
).
The implemented method uses the default behavior from the super
class DefaultHandler
startDocument
in interface org.xml.sax.ContentHandler
startDocument
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
- Any SAX exception, possibly wrapping
another exception.endDocument()
,
ContentHandler.startDocument()
public void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes) throws org.xml.sax.SAXException
endElement
.
The Parser will invoke this method at the beginning of every
element in the XML document; there will be a corresponding
endElement
event for every startElement event
(even when the element is empty). All of the element's content will be
reported, in order, before the corresponding endElement
event.
This event allows up to three name components for each element:
startElement
in interface org.xml.sax.ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
uri
- The Namespace URI, or the empty string if the element has no Namespace
URI or if Namespace processing is not being performed.localName
- The local name (without prefix), or the empty string if Namespace
processing is not being performed.qName
- The qualified name (with prefix), or the empty string if qualified
names are not available.atts
- The attributes attached to the element. If there are no attributes,
it shall be an empty Attributes object.
org.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.endElement(java.lang.String, java.lang.String, java.lang.String)
,
Attributes
,
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
The SAX parser will invoke this method at the end of every
element in the XML document; there will be a corresponding
startElement
event for every endElement
event (even when the element is empty).
For information on the names, see startElement.
endElement
in interface org.xml.sax.ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
uri
- The Namespace URI, or the empty string if the element has no
Namespace URI or if Namespace processing is not being performed.localName
- The local name (without prefix), or the empty string if
Namespace processing is not being performed.qName
- The qualified XML 1.0 name (with prefix), or the empty string
if qualified names are not available.
org.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
,
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)
public void endDocument() throws org.xml.sax.SAXException
The SAX parser will invoke this method only once, and it will be the last method invoked during the parse. The parser will not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.
The implemented method uses the default behavior from the super
class DefaultHandler
endDocument
in interface org.xml.sax.ContentHandler
endDocument
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.startDocument()
,
ContentHandler.endDocument()
public static void main(java.lang.String[] argv)
argv
- command line arguments.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |