|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwt.federation.SAXElementHandler
Event handler class for SAX.
This handler simply reports all of the events that it receives. It is useful for testing and comparing SAX implementations, and for teaching or learning about SAX. This is also a demonstration of how one class can implement all four handler interfaces.
EntityResolver
,
DTDHandler
,
DocumentHandler
,
ErrorHandler
Field Summary | |
private StringBuffer |
attributeChars
|
private boolean |
attributeStarted
|
private Vector |
attributeValues
|
private boolean |
compatible
|
private String |
elementName
|
private String |
groupName
|
private int |
ieVersion
|
private Hashtable |
objectAttributes
|
private Vector |
objects
|
private boolean |
processingStatus
|
private Hashtable |
statusObjectAttributes
|
private static boolean |
VERBOSE
|
Constructor Summary | |
SAXElementHandler()
|
Method Summary | |
void |
characters(char[] ch,
int start,
int length)
Character data received. |
void |
endDocument()
Print a message for the end of the document. |
void |
endElement(String name)
Print a message for the end of an element. |
void |
error(SAXParseException exception)
Report all recoverable errors, and try to continue parsing. |
void |
fatalError(SAXParseException exception)
Report all fatal errors, and try to continue parsing. |
String |
getElementName(AttributeList atlist)
Traverse the passed AttributeList and find the 'NAME' attribute, and return it. |
String |
getElementStatus(AttributeList atlist)
Traverse the passed AttributeList and find the 'STATUS' attribute, and return it. |
String |
getElementValue(AttributeList atlist)
Traverse the passed AttributeList and find the 'VALUE' attribute, and return it. |
Vector |
getObjects()
|
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Print a message for ignorable whitespace. |
void |
notationDecl(String name,
String publicId,
String systemId)
Display notation declarations as they are reported. |
void |
processingInstruction(String target,
String data)
Print a message for a processing instruction. |
InputSource |
resolveEntity(String publicId,
String systemId)
Display requests for entity resolution. |
void |
setDocumentLocator(Locator locator)
Print a message when the parser provides a locator. |
void |
startDocument()
Print a message at the start of the document. |
void |
startElement(String name,
AttributeList attributes)
Print a message for the start of an element. |
void |
unparsedEntityDecl(String name,
String publicId,
String systemId,
String notationName)
Display unparsed entity declarations as they are reported. |
void |
warning(SAXParseException exception)
Report all warnings, and continue parsing. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private boolean attributeStarted
private StringBuffer attributeChars
private Vector attributeValues
private boolean compatible
private String elementName
private String groupName
private int ieVersion
private Hashtable objectAttributes
private Hashtable statusObjectAttributes
private Vector objects
private boolean processingStatus
private static boolean VERBOSE
Constructor Detail |
public SAXElementHandler()
Method Detail |
public Vector getObjects()
public InputSource resolveEntity(String publicId, String systemId)
The SAX parser will invoke this method to give the application a chance to resolve entities. This implementation always returns null, so that the parser will resolve the entity itself.
resolveEntity
in interface EntityResolver
EntityResolver.resolveEntity(java.lang.String, java.lang.String)
public void notationDecl(String name, String publicId, String systemId)
notationDecl
in interface DTDHandler
DTDHandler.notationDecl(java.lang.String, java.lang.String, java.lang.String)
public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName)
unparsedEntityDecl
in interface DTDHandler
DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
public void setDocumentLocator(Locator locator)
Not all SAX parsers will provide a locator object.
setDocumentLocator
in interface DocumentHandler
DocumentHandler.setDocumentLocator(org.xml.sax.Locator)
public void startDocument()
startDocument
in interface DocumentHandler
DocumentHandler.startDocument()
public void endDocument()
endDocument
in interface DocumentHandler
DocumentHandler.endDocument()
public void startElement(String name, AttributeList attributes)
Display all attributes on separate lines, indented.
startElement
in interface DocumentHandler
DocumentHandler.startElement(java.lang.String, org.xml.sax.AttributeList)
public void endElement(String name)
endElement
in interface DocumentHandler
DocumentHandler.endElement(java.lang.String)
public void characters(char[] ch, int start, int length)
characters
in interface DocumentHandler
DocumentHandler.characters(char[], int, int)
public String getElementName(AttributeList atlist)
public String getElementValue(AttributeList atlist)
public String getElementStatus(AttributeList atlist)
public void ignorableWhitespace(char[] ch, int start, int length)
ignorableWhitespace
in interface DocumentHandler
DocumentHandler.ignorableWhitespace(char[], int, int)
public void processingInstruction(String target, String data)
processingInstruction
in interface DocumentHandler
DocumentHandler.processingInstruction(java.lang.String, java.lang.String)
public void warning(SAXParseException exception)
warning
in interface ErrorHandler
ErrorHandler.warning(org.xml.sax.SAXParseException)
public void error(SAXParseException exception)
error
in interface ErrorHandler
ErrorHandler.error(org.xml.sax.SAXParseException)
public void fatalError(SAXParseException exception)
Note: results are no longer reliable once a fatal error has been reported.
fatalError
in interface ErrorHandler
ErrorHandler.fatalError(org.xml.sax.SAXParseException)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |